Creating a cluster with kubeadm - Prabhueswaran/K8s GitHub Wiki

Creating a cluster with kubeadm

Configuring a cgroup driver

Configuring the kubelet cgroup driver

vim kubeadm-config.yaml

kind: ClusterConfiguration
apiVersion: kubeadm.k8s.io/v1beta2
kubernetesVersion: v1.22.0
---
kind: KubeletConfiguration
apiVersion: kubelet.config.k8s.io/v1beta1
cgroupDriver: systemd

add the above content in kubeadm-config.yaml file and save the file.

Initiate Cluster with kubeadm

sudo kubeadm init --config kubeadm-config.yaml

Once Kubernetes control-plane has initialized successfully use the bellow command

To start using your cluster, you need to run the following as a regular user:

 mkdir -p $HOME/.kube
 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
 sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

export KUBECONFIG=/etc/kubernetes/admin.conf

Vrify the control panel node is available using the below command

kubectl get node

Control plane node isolation

By default, your cluster will not schedule Pods on the control-plane node for security reasons. If you want to be able to schedule Pods on the control-plane node, for example for a single-machine Kubernetes cluster for development, run:

kubectl taint nodes --all node-role.kubernetes.io/master-

Cluster Networking

To enable the cluster network, run:

sudo kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f https://docs.projectcalico.org/v3.20/manifests/calico.yaml

Now verify the node status, run:

kubectl get node

Now it's ready to deploy your application.:blush: