1. Docker Install

  • Install docker prerequisite
 sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  • Add docker-ce repo
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  • Install Docker version 18.06
sudo yum install -y docker-ce-18.06.3.ce-3.el7
  • Configure Docker service for use by Kubernetes
sudo cat > /etc/docker/daemon.json << EOF
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  "storage-driver": "overlay2",
  "storage-opts": [
  • Enable and start docker services
sudo systemctl enable docker && sudo systemctl start docker
  • Verify installed docker version
sudo docker version

2. Kubernetes Install

  • Get Kubernetes GPG Key:
sudo bash -c 'cat <<EOF > /etc/yum.repos.d/kubernetes.repo
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
  • Disable SELinux to prevent communication issues:
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
  • Turn off Swap for Kubernetes installation:
sudo swapoff -a
sudo sed -e '/swap/s/^/#/g' -i /etc/fstab
  • Set following kernel parameter:
sudo cat > /etc/sysctl.d/kubernetes.conf << EOF
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
  • Reload kernel parameter config file:
modprobe br_netfilter
sysctl --system
  • Kubernetes uses following services ports on Master node:
Port Protocol Purpose
6443 TCP Kubernetes API Server
2379-2380 TCP etcd server client API
10250 TCP Kubelet API
10251 TCP kube-scheduler
10252 TCP kube-controller-manager
firewall-cmd --permanent --add-port={6443,2379,2380,10250,10251,10252}/tcp
firewall-cmd --reload
  • Kubernetes uses following services ports on Worker node:
Port Protocol Purpose
10250 TCP Kubelet API
30000-32767 TCP NodePort Service
firewall-cmd --permanent --add-port={10250,30000-32767}/tcp
firewall-cmd --reload
  • Install Kubernetes components
sudo yum install -y kubelet-1.14.10 kubeadm-1.14.10 kubectl-1.14.10 --disableexcludes=kubernetes

4. Initialize Cluster

  • Run following command as sudo on the master node:
sudo kubeadm init --pod-network-cidr=

The process might take a minute or more depending on your internet connection

  • Setup local kubeconfig:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
  • Install Antrea CNI network overlay:
kubectl apply -f https://raw.githubusercontent.com/vmware-tanzu/antrea/master/build/yamls/antrea.yml

Alternatively, you can install flannel:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

5. Setup Node to join cluster

sudo kubeadm join [your unique string from the kubeadm init command]

6. Verification

kubectl get nodes
kubectl cluster-info
kubectl config view
kubectl describe nodes
kubectl describe pods
kubectl get services --all-namespaces
kubectl get pods --all-namespaces
kubectl api-resources -o wide

Command References | Commands | Description | | :—————————————- |:———————————– | | kubectl get nodes | Get all nodes | | kubectl cluster-info | View address of master and services | | kubectl config view | Show kubeconfig settings | | kubectl describe nodes | Show all nodes details | | kubectl describe pods | Show all pods details | | kubectl get services –all-namespaces | Show all services | | kubectl get pods –all-namespaces | Show all pods in all namespaces | | kubectl api-resources -o wide | View all resources |