Kubernetes attach additional Slaves to master
Below are the steps to be followed to attach the additional slaves to an existing kubernetes cluster.
Execute below commands in Kubernetes (new) Slave:
- kubectl run -i --tty ubuntu --rm --image=ubuntu --restart=Never --overrides='
- apt-get update && apt-get install -y apt-transport-https
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF - curl -fsSL 'https://sks-keyservers.net/pks/lookup?op=get&search=0xee6d536cf7dc86e2d7d56f59a178ac6c6238f52e' | sudo apt-key add -
- sudo add-apt-repository \
"deb https://packages.docker.com/1.13/apt/repo/ \
ubuntu-$(lsb_release -cs) \
main" - apt-get update
- apt-get -y install docker-engine
    Run docker as daemon in as given below (if required): Â
     Open /lib/systemd/system/docker.service and add the below line and save the file:
     ExecStart=/usr/bin/dockerd -H fd:// -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2376 $DOCKER_OPTS
      Execute the following commands to reload and restart docker
     systemctl daemon-reload
     systemctl restart docker- apt-get install -y kubeadm=1.9.4-00 kubectl=1.9.4-00 kubelet=1.9.4-00 kubernetes-cni
- service kubelet start
To know the K8s cluster join token:
To get the join command, execute the below command in Kubernetes Master.
Command: kubeadm token create --print-join-command
Result:Â kubeadm join --token 8xxxxa.6axxxxda3xxx0fx4 <<master-ip>>:6443 --discovery-token-ca-cert-hash sha256:a54ab1234e247eeb36ba772eb442b507b0a1234f8b1234567df1234567890c01
Reference:Â https://linuxacademy.com/community/posts/show/topic/25431-tip-kubeadm-print-join-command