Install k3s and get the kubeconfig

sudo apt update adduser eramax usermod -aG sudo eramax curl -sfL | K3S_KUBECONFIG_MODE=”644″ sh – kubectl get nodes cat /var/lib/rancher/k3s/server/node-token #Copy node token sudo kubectl create serviceaccount k8sadmin -n kube-system sudo kubectl create clusterrolebinding k8sadmin –clusterrole=cluster-admin –serviceaccount=kube-system:k8sadmin sudo kubectl -n kube-system describe secret $(sudo kubectl -n kube-system get secret | (grep k8sadmin || echo “$_”) | awk […]

NCurses Disk Usage

ncdu (NCurses Disk Usage) is a curses-based version of the well-known ‘du’, and provides a fast way to see what directories are using your disk space. One can install with the following apt command/apt-get command: sudo apt install ncdu For RHEL/CentOS, first enable EPEL repo (see CentOS 8 turn on EPEL repo and RHEL 8 enable epel repo) and type the following yum command: sudo […]

Running CI tests in Kubernetes through Github Actions

Example  name: Main action on: [push] jobs: build: runs-on: ubuntu-latest timeout-minutes: 5 steps: – uses: actions/[email protected] – name: install k8s run: | curl -sfL | K3S_KUBECONFIG_MODE=777 sh – cat /etc/rancher/k3s/k3s.yaml mkdir -p ~/.kube cp /etc/rancher/k3s/k3s.yaml ~/.kube/config – name: example tests run: | kubectl cluster-info kubectl create deployment –image nginx my-nginx kubectl get po Source :

Deploy kubernetes cluster with multipass

multipass launch –name kms –cpus 1 –mem 1024M –disk 3G 16.04 multipass launch –name n1 –cpus 1 –mem 1024M –disk 3G 16.04 multipass launch –name n2 –cpus 1 –mem 1024M –disk 3G 16.04 multipass exec kms — /bin/bash -c “curl -sfL | K3S_KUBECONFIG_MODE=”644″ sh -” multipass shell kms sudo cat /var/lib/rancher/k3s/server/node-token # copy the token and ip […]

Install Kubernetes dashboard on MicroK8s on vps or barametal servers without proxy

kubectl apply -f kubectl create serviceaccount dashboard -n default kubectl create clusterrolebinding dashboard-admin -n default –clusterrole=cluster-admin –serviceaccount=default:dashboard kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath=”{.secrets[0].name}”) -o jsonpath=”{.data.token}” | base64 –decode kubectl -n kubernetes-dashboard edit service kubernetes-dashboard change the .spec.type to NodePort and add nodePort : 30100 Access the dashboard through : https://Server-IP:30100/#/login Use firefox instead of […]

How to redirect an incoming connection to a different IP address on a specific port using IPtables

Problem Redirect traffic incoming on a specific port to a different IP address / another server tl;dr Step 1: iptables -t nat -A PREROUTING -p tcp –dport 3124 -j DNAT –to-destination iptables -t nat -A POSTROUTING -j MASQUERADE Solution Below will show you how to redirect port 3124 on one machine to port 3000 on a different […]

1 2 3 9