10

I was having K3s cluster with below pods running:

kube-system   pod/calico-node-xxxx                          
kube-system   pod/calico-kube-controllers-xxxxxx   
kube-system   pod/metrics-server-xxxxx
kube-system   pod/local-path-provisioner-xxxxx
kube-system   pod/coredns-xxxxx
xyz-system    pod/some-app-xxx
xyz-system    pod/some-app-db-xxx

I want to stop all of the K3s pods & reset the containerd state, so I used /usr/local/bin/k3s-killall.sh script and all pods got stopped (at least I was not able to see anything in watch kubectl get all -A except The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port? message)

Can someone tell me how to start the k3s server up because now after firing kubectl get all -A I am getting message The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?

PS:

  • When I ran k3s server command, for fraction of seconds I can see the same above pods(with same pod ids) that I mentioned while the command is running. After few seconds, command get exited and again same message The connection to the... start displaying.

Does this means that k3s-killall.sh have not deleted my pods as it is showing the same pods with same ids ( like pod/some-app-xxx ) ?

Thor
  • 305
  • 1
  • 2
  • 11
  • 1
    As far as i know k3s uses an embedded etcd service. The etcd is keeping the state of your cluster. This includes deployments, statefulset and every other resources. To my surprise i cannot say why it's failing. Probably you could check your logs or use systemctl status k3s. Not sure, what k3s-killall.sh is actually doing. – Manuel Aug 17 '21 at 19:01

2 Answers2

15
  1. I think you need to restart K3s via systemd if you want your cluster back after kill. Try command:
    sudo systemctl restart k3s This is supported by the installation script for systemd and openrc. Refer rancher doc

  2. The pod-xxx id will remain same as k3s-killall.sh doesn't uninstall k3s (you can verify this, after k3s-killall script k3s -v will return output) and it only restart the pods with same image. The Restarts column will increase the count of all pods.

solveit
  • 869
  • 2
  • 12
  • 32
  • 2
    "sudo systemctl restart k3s" command does not have any effect. The age parameter has the same value for pods,svc and ingress components. I wanted to skip traefik server and restart k3s – Andy Dufresne Sep 16 '21 at 08:47
-2

cd /usr/local/bin

Blockquote

./k3s server