Now run the following commands to verify the status ~]# kubectl get nodes NAME STATUS AGE VERSION k8s-master Ready 1h v1.7.5 ~]# kubectl get pods -all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE kube-system etcd-k8s-master 1/1 Running 0 57m kube-system kube-apiserver-k8s-master 1/1 Running 0 57m kube-system kube-controller-manager-k8s-master 1/1 Running 0 57m kube-system kube-dns-2425271678-044ww 3/3 Running 0 1h kube-system kube-proxy-9h259 1/1 Running 0 1h kube-system kube-scheduler-k8s-master 1/1 Running 0 57m kube-system weave-net-hdjzd 2/2 Running 0 7m ~]# ~]# export kubever=$(kubectl version | base64 | tr -d 'n') ~]# kubectl apply -f "$kubever" serviceaccount "weave-net" created clusterrole "weave-net" created clusterrolebinding "weave-net" created daemonset "weave-net" created ~]#
Run the beneath command to deploy network. POD network is the overlay network between the worker nodes. To make the cluster status ready and kube-dns status running, deploy the pod network so that containers of different host communicated each other. Output of above command would be something like below Run the beneath command to initialize and setup kubernetes master. Start and enable kubectl and docker service ~]# systemctl restart docker & systemctl enable docker ~]# systemctl restart kubelet & systemctl enable kubelet Step 4: Initialize Kubernetes Master with ‘kubeadm init’
Once the package repositories are configured, run the beneath command to install kubeadm and docker packages. ~]# cat > name=Kubernetes > baseurl= > enabled=1 > gpgcheck=1 > repo_gpgcheck=1 > gpgkey= > EOF ~]# Step 3: Install Kubeadm and Docker Kubernetes packages are not available in the default CentOS 7 & RHEL 7 repositories, Use below command to configure its package repositories.
Note: In case you don’t have your own dns server then update /etc/hosts file on master and worker nodes 192.168.1.30 k8s-master 192.168.1.40 worker-node1 192.168.1.50 worker-node2ĭisable Swap in all nodes using “swapoff -a” command and remove or comment out swap partitions or swap file from fstab file Step 2: Configure Kubernetes Repository ~]# firewall-cmd -permanent -add-port=6443/tcp ~]# firewall-cmd -permanent -add-port=2379-2380/tcp ~]# firewall-cmd -permanent -add-port=10250/tcp ~]# firewall-cmd -permanent -add-port=10251/tcp ~]# firewall-cmd -permanent -add-port=10252/tcp ~]# firewall-cmd -permanent -add-port=10255/tcp ~]# firewall-cmd -reload ~]# modprobe br_netfilter ~]# echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables Login to your kubernetes master node and set the hostname and disable selinux using following commands ~]# hostnamectl set-hostname 'k8s-master' ~]# exec bash ~]# setenforce 0 ~]# sed -i -follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux Perform the following steps on Master Node Step 1: Disable SELinux & setup firewall rules Installations Steps of Kubernetes 1.7 on CentOS 7 / RHEL 7
API Server – It provides kubernetes API using Jason / Yaml over http, states of API objects are stored in etcd.On the Master Node following components will be installed