K3s Installation:
Run the below command to install k3s.
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -s - |
Installation of agent nodes
Run the below command on the master node and copy the node-token.
sudo cat /var/lib/rancher/k3s/server/node-token |
Run the below command on the server where agent node is to be installed.
curl -sfL https://get.k3s.io | K3S_URL=https://<master-node-IP>:6443 K3S_TOKEN=<master-node-token> sh - |
Enable the k3s/k3s-agent service.
sudo systemctl enable k3s.service |
Check the status of k3s/k3s-agent service.
sudo systemctl status k3s.service |
Run the below commands to uninstall k3s.
sudo systemctl stop k3s.service |
sudo /usr/local/bin/k3s-uninstall.sh |
Run the below commands to uninstall k3s agent.
sudo systemctl stop k3s.service |
sudo /usr/local/bin/k3s-agent-uninstall.sh |
K3s Troubleshooting:
error loading config file "/etc/rancher/k3s/k3s.yaml": open /etc/rancher/k3s/k3s.yaml: permission denied.
While running kubectl commands if you encounter the above error then run the below command.
sudo chmod 644 /etc/rancher/k3s/k3s.yaml |
failed to verify certificate: x509: certificate signed by unknown authority
export KUBECONFIG=~/.kube/config |
Error: INSTALLATION FAILED: Kubernetes cluster unreachable: Get “https://localhost:8080/version”: dial tcp 127.0.0.1:8080: connect: connection refused
While running helm commands if you get the above error then run the below command.
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml |
| sudo systemctl restart k3s.service OR sudo systemctl restart k3s-agent.service |
Run the below command :
kubectl delete -f bstmrouter-depl.yaml |
Run the below command :
kubectl apply -f bstmrouter-depl.yaml |