Skip to content

Instantly share code, notes, and snippets.

@febri4n
febri4n / ssl-ingress-cert-manager-haproxy.txt
Last active July 30, 2024 09:17
README! ingress with cert-manager & haproxy
# SETUP HAPROXY SEBAGAI INGRESS-NGINX HARUS MENGGUNAKAN MODE TCP.
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
@febri4n
febri4n / volumesnapshot.sh
Last active July 17, 2024 01:32
Installing VolumeSnapshot CRDs
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
@febri4n
febri4n / kamaji-worker-tcp-pre-install-openstack.sh
Last active July 31, 2024 04:01
Pre-install Kamaji Worker TCP on Openstack Instance
#!/bin/bash
# Log file
LOG="/var/log/k8s_install.log"
echo "Starting Kubernetes components installation at $(date)" | tee -a $LOG
# Load required kernel modules
echo "Loading kernel modules" | tee -a $LOG
cat <<EOF | tee /etc/modules-load.d/k8s.conf
@febri4n
febri4n / kamaji-pre-install-openstack.sh
Created July 15, 2024 02:48
Pre-install Kamaji on Openstack Instance
#!/bin/bash
# Log file
LOG="/var/log/install_script.log"
echo "Starting installation script at $(date)" | tee -a $LOG
# Docker Installation
echo "Starting Docker installation" | tee -a $LOG
@febri4n
febri4n / alert-template.yaml
Created July 12, 2024 05:52
template alert grafana email
{{ define "mailbody" }}
{{ range . }}
{{ if gt (len .Annotations) 0 }}
{{.Annotations.summary}}
{{ end }}
{{ range .Labels.SortedPairs }}
{{ end }}
{{ end }}{{ end }}
{{ define "mailsubject" }}
{{ with .Alerts.Firing }}🔥 [Alerting]{{ template "mailbody" . }}
@febri4n
febri4n / certbot-systemd-ubuntu.md
Created May 15, 2024 06:51 — forked from dbirks/certbot-systemd-ubuntu.md
Certbot renew with a systemd timer on Ubuntu

Ubuntu 16.04

/etc/systemd/system/certbot.service

[Unit]
Description=Let's Encrypt renewal

[Service]
Type=oneshot
ExecStart=/usr/bin/certbot renew --quiet --agree-tos
@febri4n
febri4n / gist:372587274fbd2a8d9b83b2d46e311594
Created April 1, 2024 16:25
clean up rancher in instance
#!/bin/sh
# Backup your data
# Use at your own risk
# Usage ./extended-cleanup-rancher2.sh
# Include clearing all iptables: ./extended-cleanup-rancher2.sh flush
docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)
docker volume rm $(docker volume ls -q)
for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done
cleanupdirs="/etc/ceph /etc/cni /etc/kubernetes /opt/cni /opt/rke /run/secrets/kubernetes.io /run/calico /run/flannel /var/lib/calico /var/lib/etcd /var/lib/cni /var/lib/kubelet /var/lib/rancher/rke/log /var/log/containers /var/log/pods /var/run/calico"
#!/bin/bash
# Step 1
curl -LO https://dl.k8s.io/release/`curl -LS https://dl.k8s.io/release/stable.txt`/bin/linux/amd64/kubectl
# Step 2
chmod +x ./kubectl
# Step 3
sudo mv ./kubectl /usr/local/bin/kubectl
@febri4n
febri4n / gist:776ddab3ef05f5f2df391e2d92aafcc9
Last active March 27, 2024 04:31
install-kube-repo-baru
#!/bin/bash
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter