0% found this document useful (0 votes)
200 views3 pages

Lab 1: Building A Kubernetes Cluster With Kubeadm: Description

This document provides instructions for building a Kubernetes cluster with Kubeadm. It describes installing Docker and Kubernetes components like Kubeadm, Kubelet and Kubectl on three nodes. It then guides boostrapping the cluster on the master node and joining the two worker nodes to the cluster. Once joined, kubectl can be used to verify the three nodes are listed and in a NotReady state as expected.

Uploaded by

sasirekha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
200 views3 pages

Lab 1: Building A Kubernetes Cluster With Kubeadm: Description

This document provides instructions for building a Kubernetes cluster with Kubeadm. It describes installing Docker and Kubernetes components like Kubeadm, Kubelet and Kubectl on three nodes. It then guides boostrapping the cluster on the master node and joining the two worker nodes to the cluster. Once joined, kubectl can be used to verify the three nodes are listed and in a NotReady state as expected.

Uploaded by

sasirekha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Lab 1: Building a Kubernetes Cluster with Kubeadm

Description
A Kubernetes cluster is a powerful tool for managing containers in a highly-available
manner. Kubeadm greatly simplifies the process of setting up a simple cluster. In this
hands-on lab, you will build your own working Kubernetes cluster using Kubeadm.

Install Docker on all three nodes.

1. Do the following on all three nodes:

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

2.Verify that Docker is up and running with:

sudo systemctl status docker

Make sure the Docker service status is active (running)!

Install Kubeadm, Kubelet, and Kubectl on all three nodes.

1.Install the Kubernetes components by running this on all three nodes:

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


y 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.7-00 kubeadm=1.12.7-00 kubectl=1.12.7-
00
sudo apt-mark hold kubelet kubeadm kubectl
Bootstrap the cluster on the Kube master node.

1. On the Kube master node, do this:

sudo kubeadm init --pod-network-cidr=10.244.0.0/16

That command may take a few minutes to complete.

2. When it is done, set up the local kubeconfig:

3. mkdir -p $HOME/.kube
4. sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

Take note that the kubeadm init command printed a long kubeadm join command to the
screen. You will need that kubeadm join command in the next step!

5. Run the following commmand on the Kube master node to verify it is up and running:

kubectl version

This command should return both a Client Version and a Server Version.

Join the two Kube worker nodes to the cluster.

1. Copy the kubeadm join command that was printed by the kubeadm init command
earlier, with the token and hash. Run this command on both worker nodes, but make
sure you add sudo in front of it:

sudo kubeadm join $some_ip:6443 --token $some_token --discovery-token


-ca-cert-hash $some_hash

2. Now, on the Kube master node, make sure your nodes joined the cluster successfully:

kubectl get nodes

Verify that all three of your nodes are listed. It will look something like this:

NAME STATUS ROLES AGE VERSION


ip-10-0-1-101 NotReady master 30s v1.12.2
ip-10-0-1-102 NotReady <none> 8s v1.12.2
ip-10-0-1-103 NotReady <none> 5s v1.12.2
Note that the nodes are expected to be in the NotReady state for now.

1. Copy the kubeadm join command that was printed by the kubeadm init command
earlier, with the token and hash. Run this command on both worker nodes, but make
sure you add sudo in front of it:

sudo kubeadm join $some_ip:6443 --token $some_token --discovery-token


-ca-cert-hash $some_hash

2. Now, on the Kube master node, make sure your nodes joined the cluster successfully:

kubectl get nodes

Verify that all three of your nodes are listed. It will look something like this:

NAME STATUS ROLES AGE VERSION


ip-10-0-1-101 NotReady master 30s v1.12.2
ip-10-0-1-102 NotReady <none> 8s v1.12.2
ip-10-0-1-103 NotReady <none> 5s v1.12.2

Note that the nodes are expected to be in the NotReady state for now.

You might also like