install

ubuntu@k0s-ctrl:~$ curl --proto '=https' --tlsv1.2 -sSf https://get.k0s.sh | sudo sh
ubuntu@k0s-ctrl:~$ k0s version
v1.31.1+k0s.1

Crea il servizio systemd:

ubuntu@k0s-ctrl:~$ sudo k0s install

Bootstrap controller

Bootstrap del nodo controller (non single mode)

ubuntu@k0s-ctrl:~$ sudo mkdir -p /etc/k0s
ubuntu@k0s-ctrl:~$ k0s config create | sudo tee /etc/k0s/k0s.yaml
ubuntu@k0s-ctrl:~$ sudo k0s install controller -c /etc/k0s/k0s.yaml
ubuntu@k0s-ctrl:~$ sudo systemctl start k0scontroller.service

Verifica:

ubuntu@k0s-ctrl:~$ sudo k0s status
Version: v1.31.1+k0s.1
Process ID: 7885
Role: controller
Workloads: false
SingleNode: false

creazione worker

Sul controller creare un token (si può redirigere su file)

ubuntu@k0s-ctrl:~$ sudo k0s token create --role=worker --expiry=100h

Sul candidato nodo installare k0s con curl (vedi sopra) e copiare il token generato nel controller in un file (es k8sworkertoken)

ubuntu@a6:~$ sudo k0s install worker --token-file ./k8s_worker_token
ubuntu@a6:~$ sudo k0s start
<(code>
Verificare il successo dell'operazione sul controller
<code>
ubuntu@k0s-ctrl:~$ kubectl get node
NAME STATUS ROLES AGE VERSION
a6 Ready <none> 4m6s v1.31.1+k0s

k0s incorpora kubectl, che fa prefissato da k0s. Esempio:

ubuntu@k0s-ctrl:~$ sudo k0s kubectl cluster-info