Pages

Wednesday, April 25, 2018

Kubernetes - Worker Node Configuration

                                         
Set the Hostname for the worker node as ‘k8s-master’  
hostnamectl set-hostname ‘k8s-node’
Disable Selinux
setenforce 0
sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
Configure the Firewall rules
firewall-cmd --permanent --add-port=10250/tcp
firewall-cmd --permanent --add-port=10255/tcp
firewall-cmd --permanent --add-port=30000-32767/tcp
firewall-cmd --permanent --add-port=6783/tcp
firewall-cmd  --reload
Set the bridge-nf-call-iptables to 1
modprobe br_netfilter
echo "1" > /proc/sys/net/bridge/bridge-nf-call-iptables
Configure the Kubernetes Yum Repo
Create a kubernetes.repo  file under /etc/yum.repos.d/ with the below contents,
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
       https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg


Disable the Swap
run the command , swapoff -a

Install , Enable & Start Docker and kubeadm
yum install kubeadm docker -y
systemctl restart docker && systemctl enable docker
systemctl  restart kubelet && systemctl enable kubelet
Join the worker Node with master
Join the worker node to the master node by running the below command ,
kubeadm join 10.131.175.138:6443 --token pe7y1r.zk9u6c07g2nlwm3h --discovery-token-ca-cert-hash sha256:48dfb2c9eda08aaed84a70011221804c80adcd700e73d870fd12d041b0054641
This command is available in the output of the “kubeadm init” command in the master node.
We can see that the node has joined the master successfully.
Check the node status using the “kubectl” command as,
As we can see the master and node are connected.

No comments :

Post a Comment