Creating a cluster with kubeadm - Prabhueswaran/K8s GitHub Wiki

Creating a cluster with kubeadm

Initiate Cluster with kubeadm

sudo kubeadm init

if you are facing any error try this command and try again

echo 1 > /proc/sys/net/ipv4/ip_forward

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://raw.githubusercontent.com/projectcalico/calico/v3.29.3/manifests/calico.yaml

Now verify the node status, run:

kubectl get node

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