./deploy_k8s.sh
After the installation of tools, configure it based on what kind of node it would be. Out of many nodes, atleast one must be chosen as master.
The only difference between worker node and master is, during the initializing stage, installs the cluster control plane components.
Make one of the node as master in a multi node cluster. To do that, initialize the kubeadm with server parameters.
kubeadm init --apiserver-advertise-address=[server_ip] --pod-network-cidr=[pod netwrok cidr] --cri-socket=unix:///var/run/cri-dockerd.sock
Initialition first runs a series of prechecks to ensure that the machine is ready to run kubernetes. These prechecks expose warnings and exit on errors. Kubeadm init then downloads and installs the cluster control plane components. This make take several minutes. After it finishes able to see:
Your Kubernetes control-plane has initialized successfully!
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubeadm join [master_ip]:6443 --token [from master node] --discovery-token-ca-cert-hash [hash generated by master] --cri-socket unix:///var/run/cri-dockerd.sock
This node has joined the cluster.
- Certificate signing request was sent to apiserver and a response was received.
- The Kubelet was informed of the new secure connection details.
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
kubeadm token create --print-join-command
You must deploy a Container Network Interface (CNI) based Pod network add-on so that your Pods can communicate with each other.
- Calico
- Cilium
- Weave-net
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"