open terminal and type the code.
brew install putty
sudo apt-get update
sudo apt-get install docker.io
• Next check the version of Docker on all 3 machines
docker ––version
sudo systemctl enable docker
sudo systemctl status docker
Since 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.list
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
sudo apt-get install kubeadm kubelet kubectl
sudo apt-mark hold kubeadm kubelet kubectl
kubeadm version
sudo swapoff –a
sudo hostnamectl set-hostname master-node
sudo hostnamectl set-hostname worker01
sudo hostnamectl set-hostname worker02
Initialize 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=all
Please 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/config
A 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.yml
kubeadm 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/config
kubectl get pods --all-namespaces
kubectl get nodes
As 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 --token
kubeadm reset
kubectl get nodes