Installing and Testing the Components of a Kubernetes Cluster

45 minutes
  • 5 Learning Objectives

About this Hands-on Lab

In this lab, you will build a cluster from scratch, as well as test the components of the cluster (including the deployments, pods, port forwarding, and services) and execute a command from within a pod. In order to build the Kubernetes cluster, we need to install the container runtime, as well as kubeadm, kubectl, and kubelet. We will then initialize the cluster, add our CNI, and add the nodes to the cluster.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install a Three Node Cluster
  • Get the gpg keys for Docker and Kubernetes and add it to your repository
  • Install docker-ce, kubelet, kubeadm, and kubectl
  • Initialize the cluster with the pod CIDR address
  • Setup the local kubeconfig
  • Apply the Calico CNI plugin
  • Join the worker nodes to the cluster
Create a Deployment
  • On the master node, create a deployment named ngnix, using the nginx image
Expose Port 80 on the Pod
  • On the master node, forward the container port 80 to 8081
  • Open a new shell to the Kubernetes master and curl port 8081 on localhost
Get the NGINX version running on the pod
  • In the original master node terminal, run the nginx -v command from inside the pod
Create a service, and verify connectivity on the node port
  • In the original master node terminal, run the commands to expose the deployment and create a NodePort service
  • Get the name of the node that the pod resides on
  • Run the curl command to that node, using the port from the service, and verify connectivity

Additional Resources

You have been given three nodes, in which you must install the components necessary to build a running Kubernetes cluster. Once the cluster has been built and you have verified all nodes are in the ready status, you need to start testing deployments, pods, services, and port forwarding, as well as executing commands from a pod. You need to perform the following in order to successfully complete this hands-on lab:

  • Install a three node Kubernetes cluster
  • Create a deployment that uses the nginx image
  • Expose only one pod on port 8081
  • Verify the NGINX version on the pod
  • Create a service for the deployment on port 80

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?