open terminal and type the code.
brew install puttysudo apt-get updatesudo apt-get install docker.io• Next check the version of Docker on all 3 machines
docker ––versionsudo systemctl enable dockersudo systemctl status dockerSince you are downloading Kubernetes from a non-standard repository, it is essential to ensure that the software is authentic. This is done by adding a signing key
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.listcurl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key addsudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"sudo apt-get install kubeadm kubelet kubectl
sudo apt-mark hold kubeadm kubelet kubectlkubeadm version
sudo swapoff –asudo hostnamectl set-hostname master-node
sudo hostnamectl set-hostname worker01
sudo hostnamectl set-hostname worker02Initialize Kubernetes on Master Node ONLY. Please note cidr 10.244.0.0/16 is designated for Flannel network. This network is required for Pods to communicate with each other.
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=allPlease copy the printout kubeadm join command (at the end of the printout) for later use. This command is unique to each cluster and will be used for joining other nodes to the cluster. Need to run the following commands to complete deployment on Master node:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/configA Pod Network is a way to allow communication between different nodes in the cluster. This tutorial uses the flannel virtual network. Enter the following command on Master node:
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.ymlkubeadm reset If show error IP address not found like that - so use this code- exmaple
(The connection to the server 192.168.x.x:6443 was refused - did you specify the right host or port? )
sudo cp /etc/kubernetes/admin.conf ~/.kube/config && sudo chown $(id -u):$(id -g) $HOME/.kube/configkubectl get pods --all-namespaceskubectl get nodesAs mentioned in the earlier steps (see Kubernetes deployment), now kubeadm join command can be used in each worker node to connect them to the cluster. Run the command on each Worker node (the token part is excluded, since your token and IP should be unique):
sudo kubeadm join 172.31.x.x:6443 --tokenkubeadm resetkubectl get nodes