Christopher Anabo
Christopher Anabo
Senior Tech Lead
Christopher Anabo

Notes

Kubernetes installation

Kubernetes installation

 


Kubernetes Worker installation

  • Obtain master node token
    • cat /var/lib/rancher/k3s/server/token
  • Worker node installation command
    • KMASTER_TOKEN=K10bb9d4b55d0fecb3b8cf4f4d741cfd81d46227a03cac93b4d0c2e31b513b99491::sever:463ae71ba6aa002fd67bd02ce7078ce4

      KMASTER_URL=https://192.168.1.200:6443

      curl -sfL https://get.k3s.io | K3S_URL="$KMASTER_URL" K3S_TOKEN="$KMASTER_TOKEN" sh -
       

Kubernetes commands 

  1. List all nodes
    • kubectl get nodes

Connect My MACBOOK to K3s Kubernetes cluster

  • Download the k3s master node kube config file, K3s is using k3s.yaml file located at /etc/rancher/k3s directory
    • You can also check the directory /etc/kubernetes/admin.conf for other kubernetes cluster deployment
  • On your local MacBook you need to setup the kubectl config directory
    • mkdir -p ~/.kube
  • Copy the cube confg file to your MACBOOK using scp
    • scp apps@192.168.1.200:/etc/rancher/k3s/k3s.yaml ~/.kube/config
  • You also need to change the server address inside the config file
    • vi ~/.kube/config
    • change the server address to your kmaster node address
      • server: https://192.168.1.200:6443
  • Test if it works
    • kubectl get nodes