We Value Your Time – OpenSource Community
We Value Your Time – OpenSource Community

Installing Kubernetes on Centos 7/RHEL7 with kubeadm step by step.


Kubeadm is a utility which is currently is in alpha which provides kubernetes very easily.


1. One or more physical and virtual machines running CentOS 7 or RHEL 7.

2. 1GB or more of RAM per machine.

3. Network connectivity between machines in the cluster.

4. Good internet connectivity.

Installation Steps:

Follow below steps on every node.

setenforce 0

A. Set system hostname:
(You can change hostname according to you nodes.)

hostnamectl set-hostname node10.dockerhunt.com

B. Install and activate iptables and disable firewalld (as kubernetes and docker uses iptables.)

yum install iptables-services.x86_64 -y
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl mask firewalld.service
systemctl start iptables
systemctl enable iptables
systemctl unmask iptables
iptables -F
service iptables save

C. Install docker latest stable rpm provided by Docker.

yum install -y yum-utils
yum-config-manager –add-repo \
yum makecache fast
yum install -y docker-engine
D. Install Kubernetes latest stable rpm provided kubernetes:
cat < /etc/yum.repos.d/kubernetes.repo
yum install -y docker kubelet kubeadm kubectl kubernetes-cni

E. Enable and start kubernetes and docker services:

systemctl enable docker 
systemctl start docker
systemctl enable kubelet

F. Follow below steps on Kubernetes master Host:

kubeadm init –pod-network-cidr=

I. Below will be the output of kubeadm command:

[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.
[preflight] Running pre-flight checks
[init] Using Kubernetes version: v1.5.2
[tokens] Generated token: "4e4f80.fb6c903e351fb64c"
[certificates] Generated Certificate Authority key and certificate.
[certificates] Generated API Server key and certificate
[certificates] Generated Service Account signing keys
[certificates] Created keys and certificates in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[apiclient] Created API client, waiting for the control plane to become ready
[apiclient] All control plane components are healthy after 550.795507 seconds
[apiclient] Waiting for at least one node to register and become ready
[apiclient] First node is ready after 3.002701 seconds
[apiclient] Creating a test deployment
[apiclient] Test deployment succeeded
[token-discovery] Created the kube-discovery deployment, waiting for it to become ready
[token-discovery] kube-discovery is ready after 533.505279 seconds
[addons] Created essential addon: kube-proxy
[addons] Created essential addon: kube-dns
Your Kubernetes master has initialized successfully!
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
You can now join any number of machines by running the following on each node:
kubeadm join --token=4e4f80.fb6c903e351fb64c

Above token is important as it will be used for joining other nodes in the cluster.

J. By default Kubernetes will not start pods on master nodes for security reason you can remove this security if you are going to use a single node.

kubectl taint nodes --all dedicated-

K. Run below command for flannel networking services:

export ARCH=amd64
curl -sSL "https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml?raw=true" | sed "s/amd64/${ARCH}/g" | kubectl create -f -
L. Now wait for some more minutes and check all pods status.
kubectl get pods --all-namespaces

Leave a comment

Your email address will not be published. Required fields are marked *