Kubernetes: Difference between revisions

From Piszczynski
(Created page with "==Create Pod== Create pod with the following command:<syntaxhighlight lang="bash"> kubectl apply -f pod.yaml #apply the config in the .yaml file </syntaxhighlight>inspect the pods conents:<syntaxhighlight lang="bash"> ps auxf </syntaxhighlight>use ctl command to see base info:<syntaxhighlight lang="bash"> sudo ctr --namespace=k8s.io containers ls </syntaxhighlight>")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
== 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:<syntaxhighlight lang="bash">
rm /etc/containerd/config.toml
systemctl restart containerd
kubeadm init
</syntaxhighlight>You may need to open the following ports to allow nodes to communicate with the control plane:<syntaxhighlight lang="bash">
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
</syntaxhighlight>Then open the following ports on the worker nodes:<syntaxhighlight lang="bash">
sudo firewall-cmd --permanent --add-port=10251/tcp
sudo firewall-cmd --permanent --add-port=10255/tcp
firewall-cmd --reload
</syntaxhighlight>
==Create Pod==
==Create Pod==
Create pod with the following command:<syntaxhighlight lang="bash">
Create pod with the following command:<syntaxhighlight lang="bash">
Line 8: Line 36:
</syntaxhighlight>use ctl command to see base info:<syntaxhighlight lang="bash">
</syntaxhighlight>use ctl command to see base info:<syntaxhighlight lang="bash">
sudo ctr --namespace=k8s.io containers ls
sudo ctr --namespace=k8s.io containers ls
</syntaxhighlight>See running containers in the pod using ctl:<syntaxhighlight lang="bash">
sudo crictl ps


</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 17:50, 27 May 2024

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