Kubernetes – Rocky Linux

https://www.centlinux.com/2022/11/install-kubernetes-master-node-rocky-linux.html

CNI Plugin:
https://www.tkng.io/cni/flannel/

kubeadm init

kubeadm init --pod-network-cidr=10.244.0.0/16

Create file: /run/flannel/subnet.env

FLANNEL_NETWORK=10.244.0.0/16
FLANNEL_SUBNET=10.244.0.1/24
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true

Testing Deployment

kubectl get pods --all-namespaces
kubectl run test --image=nginx
kubectl get pod -o wide

Flannel File Path:

/opt/cni/bin/flannel

Kubelet Logs:
journalctl -u kubelet

kubectl cluster-info

Useful Commands:

kubectl get pods –all-namespaces
kubectl run test –image=nginx
kubectl get pod -o wide

kubeadm

kubeadm reset
kubeadm init
kubeadm get node
kubeadm config images pull
kubeadm join –help | grep token

Kubernetes Deployment:

Create YAML File:
test-deployment.yaml

Apply/Create YAML file
kubectl apply -f test-deployment.yaml

Display Created Pods
kubectl get pod
kubectl get deployment
kubectl delete pod test 1 test 2

Display Service & Endpoints
kubectl get svc
kubectl describe svc service-name
kubectl get ep (endpoints)

POD DNS Resolution not working:
kubectl -n kube-system rollout restart deployment coredns

Fully Qualified Domain Name:
<servicename>.<namespace>.svc.cluster.local

Using Kubernetes version: v1.26.2

[init] Using Kubernetes version: v1.26.2
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: time="2023-03-01T03:38:05-06:00" level=fatal msg="validate service connection: CRI v1 runtime API is not implemented for endpoint \"unix:///var/run/containerd/containerd.sock\": rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService"
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with --ignore-preflight-errors=...
To see the stack trace of this error execute with --v=5 or higher
sudo rm /etc/containerd/config.toml
sudo systemctl restart containerd
sudo kubeadm init

https://github.com/containerd/containerd/issues/4581