k0s status

May 22, 2022

To determine the role of each node in the k0s cluster, we can ssh in and then run a k0s status command which will detail the role of the machine.

So for each worker it returns:

tjs@node3:~$ sudo k0s status
[sudo] password for tjs: 
Version: v1.22.4+k0s.1
Process ID: 340
Role: worker
Workloads: true

and for the controller, it returns:

tjs@node2:~$ sudo k0s status
[sudo] password for tjs: 
Version: v1.22.4+k0s.1
Process ID: 335
Role: controller
Workloads: false

Once we're on the controller node we can list the pods that are running:

tjs@node2:~$ sudo k0s kubectl get pods --all-namespaces
NAMESPACE     NAME                              READY   STATUS    RESTARTS      AGE
kube-system   coredns-77b4ff5f78-69nlz          1/1     Running   2 (10m ago)   10d
kube-system   coredns-77b4ff5f78-hd648          1/1     Running   1 (10m ago)   10d
kube-system   konnectivity-agent-c2qx7          1/1     Running   0             10d
kube-system   konnectivity-agent-gkcnp          1/1     Running   1 (10m ago)   10d
kube-system   konnectivity-agent-xq2kv          1/1     Running   2 (10m ago)   10d
kube-system   kube-proxy-4qvwt                  1/1     Running   2 (10m ago)   10d
kube-system   kube-proxy-99tn8                  1/1     Running   1 (10d ago)   10d
kube-system   kube-proxy-zk5mt                  1/1     Running   2 (10m ago)   10d
kube-system   kube-router-86phq                 1/1     Running   1 (10d ago)   10d
kube-system   kube-router-sqqgw                 1/1     Running   1 (10m ago)   10d 
kube-system   kube-router-txt94                 1/1     Running   2 (10m ago)   10d
kube-system   metrics-server-5b898fd875-kb9zc   1/1     Running   2 (10m ago)   10d

We can also list the available nodes in the cluster:

tjs@node2:~$ sudo k0s kubectl get nodes -o wide
NAME    STATUS   ROLES    AGE   VERSION       INTERNAL-IP    EXTERNAL-IP   OS-IMAGE                       KERNEL-VERSION    CONTAINER-RUNTIME
node1   Ready    <none>   10d   v1.22.4+k0s   192.168.1.81   <none>        Debian GNU/Linux 10 (buster)   4.19.0-20-amd64   containerd://1.5.8
node3   Ready    <none>   10d   v1.22.4+k0s   192.168.1.83   <none>        Debian GNU/Linux 10 (buster)   4.19.0-20-amd64   containerd://1.5.8
node4   Ready    <none>   10d   v1.22.4+k0s   192.168.1.84   <none>        Debian GNU/Linux 10 (buster)   4.19.0-20-amd64   containerd://1.5.8