Kubernetes

From Piszczynski
Revision as of 17:50, 27 May 2024 by Aleks (talk | contribs) (→‎Install Kubeadm)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Install Kubeadm

Install Kubeadm with the following steps:

https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/

Error with running kubeadm init

Error can be caused by containerd running.

Error seen: "[ERROR CRI]: container runtime is not running: output: time="2024-05-27T17:40:33+01:00" level=fatal msg="validate service connection: validate CRI v1 runtime API for endpoint \"unix:///var/run/containerd/containerd.sock\": rpc error: code = Unimplemented desc = unknown service "

fix by deleting the containerd config file and restarting containerd:

rm /etc/containerd/config.toml
systemctl restart containerd
kubeadm init

You may need to open the following ports to allow nodes to communicate with the control plane:

sudo firewall-cmd --permanent --add-port=6443/tcp
sudo firewall-cmd --permanent --add-port=2379-2380/tcp
sudo firewall-cmd --permanent --add-port=10250/tcp
sudo firewall-cmd --permanent --add-port=10251/tcp
sudo firewall-cmd --permanent --add-port=10252/tcp
sudo firewall-cmd --permanent --add-port=10255/tcp
sudo firewall-cmd –reload

Then open the following ports on the worker nodes:

sudo firewall-cmd --permanent --add-port=10251/tcp
sudo firewall-cmd --permanent --add-port=10255/tcp
firewall-cmd --reload

Create Pod

Create pod with the following command:

kubectl apply -f pod.yaml #apply the config in the .yaml file

inspect the pods conents:

ps auxf

use ctl command to see base info:

sudo ctr --namespace=k8s.io containers ls

See running containers in the pod using ctl:

sudo crictl ps