Kubernetes Cluster Setup

Spin 3 ubuntu servers

Step 1: Install Docker

The first step in setting up a new cluster is to install a container runtime such as Docker. In this lesson, we will be installing Docker on our three servers in preparation for standing up a Kubernetes cluster. After completing this lesson, you should have three playground servers, all with Docker up and running.

Here are the commands used in this lesson:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

sudo add-apt-repository    “deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable”

sudo apt-get update

sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu

sudo apt-mark hold docker-ce

You can verify that docker is working by running this command:

sudo docker version

 

 

Step 2: Install Kubernetes Components

Now that Docker is installed, we are ready to install the Kubernetes components. In this lesson, I will guide you through the process of installing Kubeadm, Kubelet, and Kubectl on all three playground servers. After completing this lesson, you should be ready for the next step, which is to bootstrap the cluster.

Here are the commands used to install the Kubernetes components in this lesson. Run these on all three servers.

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add –

cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

sudo apt-get update

sudo apt-get install -y kubelet=1.12.2-00 kubeadm=1.12.2-00 kubectl=1.12.2-00

sudo apt-mark hold kubelet kubeadm kubectl

After installing these components, verify that Kubeadm is working by getting the version info.

kubeadm version

 

Step 3:  bootstrap the cluster on the Kube master node

 

Now we are ready to get a real Kubernetes cluster up and running! In this lesson, we will bootstrap the cluster on the Kube master node. Then, we will join each of the two worker nodes to the cluster, forming an actual multi-node Kubernetes cluster.

Here are the commands used in this lesson:

 

 

Step 4:  Setup Networking using Fannel:

 

Once the Kubernetes cluster is set up, we still need to configure cluster networking in order to make the cluster fully functional. In this lesson, we will walk through the process of configuring a cluster network using Flannel. You can find more information on Flannel at the official site: https://coreos.com/flannel/docs/latest/.

Here are the commands used in this lesson:

Further Reading:

https://www.linuxtechi.com/install-kubernetes-1-7-centos7-rhel7/

https://www.assistanz.com/steps-to-install-kubernetes-cluster-manually-using-centos-7/

https://blog.laputa.io/kubernetes-flannel-networking-6a1cb1f8ec7c

Nihar Malali Avatar

Posted by

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.