Skip to content

Instantly share code, notes, and snippets.

@k4mrul
Last active August 6, 2025 07:24
Show Gist options
  • Select an option

  • Save k4mrul/a8e0753d90a9b6e07cd1844aae94d47d to your computer and use it in GitHub Desktop.

Select an option

Save k4mrul/a8e0753d90a9b6e07cd1844aae94d47d to your computer and use it in GitHub Desktop.

Revisions

  1. k4mrul revised this gist Aug 6, 2025. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -104,10 +104,10 @@ write_files:
    # for aws
    #TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60")
    #PRIVATE_IP=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4)
    sudo echo 1 > /proc/sys/net/ipv4/ip_forward
    sudo iptables -t nat -A PREROUTING -d "$PRIVATE_IP" -p tcp --dport 80 -j DNAT --to-destination 10.42.42.0:80
    sudo iptables -t nat -A PREROUTING -d "$PRIVATE_IP" -p tcp --dport 443 -j DNAT --to-destination 10.42.42.0:443
    sudo iptables-save
    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A PREROUTING -d "$PRIVATE_IP" -p tcp --dport 80 -j DNAT --to-destination 10.42.42.0:80
    iptables -t nat -A PREROUTING -d "$PRIVATE_IP" -p tcp --dport 443 -j DNAT --to-destination 10.42.42.0:443
    iptables-save
    ## install longhorn storage class
  2. k4mrul revised this gist Aug 1, 2025. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,8 @@ write_files:
    helm upgrade --install cilium cilium/cilium --kubeconfig /home/ubuntu/.kube/config --namespace kube-system -f https://gist.github.com/k4mrul/c3b93fc6619b6de307d3ee11d536e0d7/raw
    sleep 60
    k0s kubectl apply -f https://gist.github.com/k4mrul/e462957521e4d0714a2e50090e9eccfd/raw
    k0s kubectl create ns flux-system
    # Install ingress-nginx
    # helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    # helm repo update
  3. k4mrul revised this gist Aug 1, 2025. 1 changed file with 17 additions and 17 deletions.
    34 changes: 17 additions & 17 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -78,25 +78,25 @@ write_files:
    k0s kubectl apply -f https://gist.github.com/k4mrul/e462957521e4d0714a2e50090e9eccfd/raw
    # Install ingress-nginx
    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    helm upgrade --install ingress-nginx ingress-nginx \
    --kubeconfig /home/ubuntu/.kube/config \
    --repo https://kubernetes.github.io/ingress-nginx \
    --namespace ingress-nginx --create-namespace \
    --version 4.11.7 \
    --set controller.service.type=LoadBalancer
    # helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    # helm repo update
    # helm upgrade --install ingress-nginx ingress-nginx \
    # --kubeconfig /home/ubuntu/.kube/config \
    # --repo https://kubernetes.github.io/ingress-nginx \
    # --namespace ingress-nginx --create-namespace \
    # --version 4.11.7 \
    # --set controller.service.type=LoadBalancer
    # Cert-manager
    helm repo add jetstack https://charts.jetstack.io
    helm repo update
    helm install \
    cert-manager jetstack/cert-manager \
    --kubeconfig /home/ubuntu/.kube/config \
    --namespace cert-manager \
    --create-namespace \
    --version v1.17.2 \
    --set crds.enabled=true
    # helm repo add jetstack https://charts.jetstack.io
    # helm repo update
    # helm install \
    # cert-manager jetstack/cert-manager \
    # --kubeconfig /home/ubuntu/.kube/config \
    # --namespace cert-manager \
    # --create-namespace \
    # --version v1.17.2 \
    # --set crds.enabled=true
    # forward request to cilium bgp (NOTE, only apply this AFTER adding letsencrypt-staging and letsencrypt-prod clusterissuer. If you apply before, clusterissuer will be not ready state!)
    PRIVATE_IP=$(hostname -I | awk '{print $1}')
  4. k4mrul revised this gist Aug 1, 2025. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -73,14 +73,15 @@ write_files:
    # Install cilium via helm
    helm repo add cilium https://helm.cilium.io/
    helm repo update
    helm upgrade --install cilium cilium/cilium --namespace kube-system -f https://gist.github.com/k4mrul/c3b93fc6619b6de307d3ee11d536e0d7/raw
    helm upgrade --install cilium cilium/cilium --kubeconfig /home/ubuntu/.kube/config --namespace kube-system -f https://gist.github.com/k4mrul/c3b93fc6619b6de307d3ee11d536e0d7/raw
    sleep 60
    k0s kubectl apply -f https://gist.github.com/k4mrul/e462957521e4d0714a2e50090e9eccfd/raw
    # Install ingress-nginx
    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    helm upgrade --install ingress-nginx ingress-nginx \
    --kubeconfig /home/ubuntu/.kube/config \
    --repo https://kubernetes.github.io/ingress-nginx \
    --namespace ingress-nginx --create-namespace \
    --version 4.11.7 \
    @@ -91,6 +92,7 @@ write_files:
    helm repo update
    helm install \
    cert-manager jetstack/cert-manager \
    --kubeconfig /home/ubuntu/.kube/config \
    --namespace cert-manager \
    --create-namespace \
    --version v1.17.2 \
  5. k4mrul revised this gist Jul 11, 2025. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -68,6 +68,8 @@ write_files:
    curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
    mv kustomize /usr/local/bin/kustomize
    sleep 60
    # Install cilium via helm
    helm repo add cilium https://helm.cilium.io/
    helm repo update
  6. k4mrul revised this gist Jul 9, 2025. 1 changed file with 8 additions and 4 deletions.
    12 changes: 8 additions & 4 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -95,10 +95,14 @@ write_files:
    --set crds.enabled=true
    # forward request to cilium bgp (NOTE, only apply this AFTER adding letsencrypt-staging and letsencrypt-prod clusterissuer. If you apply before, clusterissuer will be not ready state!)
    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.42.42.0:80
    iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.42.42.0:443
    iptables-save
    PRIVATE_IP=$(hostname -I | awk '{print $1}')
    # for aws
    #TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60")
    #PRIVATE_IP=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4)
    sudo echo 1 > /proc/sys/net/ipv4/ip_forward
    sudo iptables -t nat -A PREROUTING -d "$PRIVATE_IP" -p tcp --dport 80 -j DNAT --to-destination 10.42.42.0:80
    sudo iptables -t nat -A PREROUTING -d "$PRIVATE_IP" -p tcp --dport 443 -j DNAT --to-destination 10.42.42.0:443
    sudo iptables-save
    ## install longhorn storage class
  7. k4mrul revised this gist Jul 9, 2025. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -74,13 +74,7 @@ write_files:
    helm upgrade --install cilium cilium/cilium --namespace kube-system -f https://gist.github.com/k4mrul/c3b93fc6619b6de307d3ee11d536e0d7/raw
    sleep 60
    k0s kubectl apply -f https://gist.github.com/k4mrul/e462957521e4d0714a2e50090e9eccfd/raw
    ##forward request to cilium bgp
    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.42.42.0:80
    iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.42.42.0:443
    iptables-save
    # Install ingress-nginx
    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    @@ -100,6 +94,12 @@ write_files:
    --version v1.17.2 \
    --set crds.enabled=true
    # forward request to cilium bgp (NOTE, only apply this AFTER adding letsencrypt-staging and letsencrypt-prod clusterissuer. If you apply before, clusterissuer will be not ready state!)
    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.42.42.0:80
    iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.42.42.0:443
    iptables-save
    ## install longhorn storage class
    # k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
  8. k4mrul revised this gist Jul 9, 2025. 1 changed file with 3 additions and 27 deletions.
    30 changes: 3 additions & 27 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -68,17 +68,7 @@ write_files:
    curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
    mv kustomize /usr/local/bin/kustomize
    # Install Cilium CLI
    #CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
    #CLI_ARCH=amd64
    #if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
    #curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    #sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
    #sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
    #rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    #cilium install --version 1.17.4
    ##Install cilium via helm (recommended)
    # Install cilium via helm
    helm repo add cilium https://helm.cilium.io/
    helm repo update
    helm upgrade --install cilium cilium/cilium --namespace kube-system -f https://gist.github.com/k4mrul/c3b93fc6619b6de307d3ee11d536e0d7/raw
    @@ -91,7 +81,7 @@ write_files:
    iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.42.42.0:443
    iptables-save
    ##Install ingress-nginx
    # Install ingress-nginx
    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    helm upgrade --install ingress-nginx ingress-nginx \
    @@ -100,7 +90,7 @@ write_files:
    --version 4.11.7 \
    --set controller.service.type=LoadBalancer
    ##Cert-manager
    # Cert-manager
    helm repo add jetstack https://charts.jetstack.io
    helm repo update
    helm install \
    @@ -113,20 +103,6 @@ write_files:
    ## install longhorn storage class
    # k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    # Install Go
    #wget -q https://go.dev/dl/go1.24.2.linux-${ARCH}.tar.gz
    #tar -xvf go1.24.2.linux-${ARCH}.tar.gz
    #mv go /usr/local
    #echo "export GOROOT=/usr/local/go" >> /etc/bash.bashrc
    #echo "export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH" >> /etc/bash.bashrc
    #ln -sf /usr/local/go/bin/go /bin/go
    # Install Docker
    #curl -fsSL get.docker.com -o get-docker.sh
    #sudo sh get-docker.sh
    #sudo systemctl start docker
    #sudo systemctl enable docker
    # Add ubuntu user to docker group
    sudo usermod -aG docker ubuntu
  9. k4mrul revised this gist Jul 4, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -86,6 +86,7 @@ write_files:
    k0s kubectl apply -f https://gist.github.com/k4mrul/e462957521e4d0714a2e50090e9eccfd/raw
    ##forward request to cilium bgp
    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.42.42.0:80
    iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.42.42.0:443
    iptables-save
  10. k4mrul revised this gist Jul 4, 2025. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -85,6 +85,11 @@ write_files:
    sleep 60
    k0s kubectl apply -f https://gist.github.com/k4mrul/e462957521e4d0714a2e50090e9eccfd/raw
    ##forward request to cilium bgp
    iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.42.42.0:80
    iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.42.42.0:443
    iptables-save
    ##Install ingress-nginx
    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    @@ -108,11 +113,6 @@ write_files:
    ## install longhorn storage class
    # k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    # tweak
    sudo sysctl fs.inotify.max_user_instances=1280
    sudo sysctl fs.inotify.max_user_watches=655360
    echo -e "fs.inotify.max_user_instances=1280\nfs.inotify.max_user_watches=655360" | sudo tee /etc/sysctl.d/99-inotify.conf > /dev/null && sudo sysctl --system
    # Install Go
    #wget -q https://go.dev/dl/go1.24.2.linux-${ARCH}.tar.gz
    #tar -xvf go1.24.2.linux-${ARCH}.tar.gz
  11. k4mrul revised this gist Jul 4, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,7 @@ packages:
    - bash-completion
    - make
    - vim
    - iptables
    - g++
    - jq
    - fzf
  12. k4mrul revised this gist Jul 4, 2025. 1 changed file with 34 additions and 8 deletions.
    42 changes: 34 additions & 8 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -68,16 +68,42 @@ write_files:
    mv kustomize /usr/local/bin/kustomize
    # Install Cilium CLI
    CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
    CLI_ARCH=amd64
    if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
    curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
    sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
    rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    cilium install --version 1.17.4
    #CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
    #CLI_ARCH=amd64
    #if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
    #curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    #sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
    #sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
    #rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    #cilium install --version 1.17.4
    ##Install cilium via helm (recommended)
    helm repo add cilium https://helm.cilium.io/
    helm repo update
    helm upgrade --install cilium cilium/cilium --namespace kube-system -f https://gist.github.com/k4mrul/c3b93fc6619b6de307d3ee11d536e0d7/raw
    sleep 60
    k0s kubectl apply -f https://gist.github.com/k4mrul/e462957521e4d0714a2e50090e9eccfd/raw
    ##Install ingress-nginx
    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    helm upgrade --install ingress-nginx ingress-nginx \
    --repo https://kubernetes.github.io/ingress-nginx \
    --namespace ingress-nginx --create-namespace \
    --version 4.11.7 \
    --set controller.service.type=LoadBalancer
    ##Cert-manager
    helm repo add jetstack https://charts.jetstack.io
    helm repo update
    helm install \
    cert-manager jetstack/cert-manager \
    --namespace cert-manager \
    --create-namespace \
    --version v1.17.2 \
    --set crds.enabled=true
    ## install longhorn storage class
    # k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
  13. k4mrul revised this gist Jul 4, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,7 @@ package_update: true
    packages:
    - bash-completion
    - make
    - vim
    - g++
    - jq
    - fzf
  14. k4mrul revised this gist Jul 4, 2025. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -94,10 +94,10 @@ write_files:
    #ln -sf /usr/local/go/bin/go /bin/go
    # Install Docker
    curl -fsSL get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo systemctl start docker
    sudo systemctl enable docker
    #curl -fsSL get.docker.com -o get-docker.sh
    #sudo sh get-docker.sh
    #sudo systemctl start docker
    #sudo systemctl enable docker
    # Add ubuntu user to docker group
    sudo usermod -aG docker ubuntu
  15. k4mrul revised this gist Jul 4, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -83,6 +83,7 @@ write_files:
    # tweak
    sudo sysctl fs.inotify.max_user_instances=1280
    sudo sysctl fs.inotify.max_user_watches=655360
    echo -e "fs.inotify.max_user_instances=1280\nfs.inotify.max_user_watches=655360" | sudo tee /etc/sysctl.d/99-inotify.conf > /dev/null && sudo sysctl --system
    # Install Go
    #wget -q https://go.dev/dl/go1.24.2.linux-${ARCH}.tar.gz
  16. k4mrul revised this gist May 25, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -78,7 +78,7 @@ write_files:
    sleep 60
    ## install longhorn storage class
    k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    # k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    # tweak
    sudo sysctl fs.inotify.max_user_instances=1280
  17. k4mrul revised this gist May 25, 2025. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -74,9 +74,11 @@ write_files:
    sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
    sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
    rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    cilium install --version 1.17.4
    sleep 60
    ## install longhorn storage class
    #k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    # tweak
    sudo sysctl fs.inotify.max_user_instances=1280
  18. k4mrul revised this gist May 25, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,7 @@ write_files:
    rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    ## install longhorn storage class
    k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    #k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    # tweak
    sudo sysctl fs.inotify.max_user_instances=1280
  19. k4mrul revised this gist May 22, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,7 @@ write_files:
    rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    ## install longhorn storage class
    kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    k0s kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    # tweak
    sudo sysctl fs.inotify.max_user_instances=1280
  20. k4mrul revised this gist May 22, 2025. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -91,13 +91,13 @@ write_files:
    #ln -sf /usr/local/go/bin/go /bin/go
    # Install Docker
    #curl -fsSL get.docker.com -o get-docker.sh
    #sudo sh get-docker.sh
    #sudo systemctl start docker
    #sudo systemctl enable docker
    curl -fsSL get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo systemctl start docker
    sudo systemctl enable docker
    # Add ubuntu user to docker group
    #sudo usermod -aG docker ubuntu
    sudo usermod -aG docker ubuntu
    runcmd:
    - [ bash, /root/setup.sh ]
  21. k4mrul revised this gist May 22, 2025. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -75,6 +75,9 @@ write_files:
    sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
    rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    ## install longhorn storage class
    kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.1/deploy/longhorn.yaml
    # tweak
    sudo sysctl fs.inotify.max_user_instances=1280
    sudo sysctl fs.inotify.max_user_watches=655360
  22. k4mrul revised this gist May 22, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -64,7 +64,7 @@ write_files:
    # install kustomize
    curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
    sudo mv kustomize /usr/local/bin/kustomize
    mv kustomize /usr/local/bin/kustomize
    # Install Cilium CLI
    CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
  23. k4mrul revised this gist May 22, 2025. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -62,6 +62,10 @@ write_files:
    # Install Helm
    curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
    # install kustomize
    curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
    sudo mv kustomize /usr/local/bin/kustomize
    # Install Cilium CLI
    CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
    CLI_ARCH=amd64
  24. k4mrul revised this gist May 22, 2025. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -71,6 +71,10 @@ write_files:
    sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
    rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    # tweak
    sudo sysctl fs.inotify.max_user_instances=1280
    sudo sysctl fs.inotify.max_user_watches=655360
    # Install Go
    #wget -q https://go.dev/dl/go1.24.2.linux-${ARCH}.tar.gz
    #tar -xvf go1.24.2.linux-${ARCH}.tar.gz
  25. k4mrul revised this gist May 12, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -46,7 +46,7 @@ write_files:
    ## Changing to ipvs mode
    yq e '.spec.network.kubeProxy.mode = "ipvs"' -i /root/k0s.yaml
    ## add vm ip to sans
    yq e ".spec.api.sans += [\"${EXTERNAL_IP}\"]" -i
    yq e ".spec.api.sans += [\"${EXTERNAL_IP}\"]" -i /root/k0s.yaml
    ## Install k8s
    k0s install controller --enable-worker --no-taints -c /root/k0s.yaml
    k0s start
  26. k4mrul revised this gist May 12, 2025. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,7 @@ write_files:
    set -e
    ARCH=$(dpkg --print-architecture)
    EXTERNAL_IP=$(curl -s ifconfig.me)
    # Install yq
    wget "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${ARCH}" -O /usr/bin/yq && chmod +x /usr/bin/yq
    @@ -44,6 +45,8 @@ write_files:
    ##yq eval '.spec.network.kubeProxy.disabled = true' -i /root/k0s.yaml
    ## Changing to ipvs mode
    yq e '.spec.network.kubeProxy.mode = "ipvs"' -i /root/k0s.yaml
    ## add vm ip to sans
    yq e ".spec.api.sans += [\"${EXTERNAL_IP}\"]" -i
    ## Install k8s
    k0s install controller --enable-worker --no-taints -c /root/k0s.yaml
    k0s start
  27. k4mrul revised this gist May 12, 2025. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ write_files:
    ARCH=$(dpkg --print-architecture)
    # Install yq
    wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq
    wget "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${ARCH}" -O /usr/bin/yq && chmod +x /usr/bin/yq
    # Install kubectl
    wget -q "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${ARCH}/kubectl"
    @@ -41,7 +41,9 @@ write_files:
    ## we will setup cilium cni
    sed -i 's/provider: kuberouter/provider: custom/' /root/k0s.yaml
    ## disable kubeproxy (maybe not needed but necessary for laaaarge cluster) for cilium handle routing with eBPF
    yq eval '.spec.network.kubeProxy.disabled = true' -i /root/k0s.yaml
    ##yq eval '.spec.network.kubeProxy.disabled = true' -i /root/k0s.yaml
    ## Changing to ipvs mode
    yq e '.spec.network.kubeProxy.mode = "ipvs"' -i /root/k0s.yaml
    ## Install k8s
    k0s install controller --enable-worker --no-taints -c /root/k0s.yaml
    k0s start
  28. k4mrul revised this gist May 9, 2025. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -55,9 +55,7 @@ write_files:
    chown ubuntu:ubuntu /home/ubuntu/.kube/ -R
    # Install Helm
    HELM_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/helm/helm/releases/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
    tar -xvz -C /tmp/ -f <(wget -q -O - https://get.helm.sh/helm-${HELM_RELEASE}-linux-${ARCH}.tar.gz)
    install -o root -g root -m 0755 /tmp/linux-${ARCH}/helm /usr/local/bin/helm
    curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
    # Install Cilium CLI
    CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
  29. k4mrul revised this gist May 5, 2025. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,9 @@ write_files:
    wget -q "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${ARCH}/kubectl"
    install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
    rm kubectl
    # Install fluxcd
    curl -s https://fluxcd.io/install.sh | sudo bash
    # Enable bash completion for kubectl
    echo "source /usr/share/bash-completion/bash_completion" >> /home/ubuntu/.bashrc
  30. k4mrul revised this gist May 5, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -26,6 +26,7 @@ write_files:
    # Enable bash completion for kubectl
    echo "source /usr/share/bash-completion/bash_completion" >> /home/ubuntu/.bashrc
    echo "source <(kubectl completion bash)" >> /home/ubuntu/.bashrc
    echo "complete -F __start_kubectl k" >> /home/ubuntu/.bashrc
    echo "alias k=kubectl" >> /home/ubuntu/.bashrc