Building and Using a K3s Cluster

30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

In this lab, you will walk through the entire process of bootstrapping a working K3s cluster. You will install K3s on multiple servers. Then, you will configure those servers to form a multi-server cluster. Finally, you will run an application on your cluster to demonstrate that everything is working. After completing this lab, you will have built a K3s cluster from start to finish!

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Build the K3s Server
  1. Log in to the K3s Server instance.
  2. Install K3s in such a way that this instance will function as a K3s server.
Build the K3s Worker Nodes
  1. Log in to both K3s Worker 1 and K3s Worker 2.
  2. Install K3s on both instances so they will function as worker nodes and form a cluster with the K3s server.
Run a Sample Application on the New Cluster
  1. Log in to the K3s Server instance.

  2. Create a pod that runs the wernight/funbox image: fortune | cowsay.

  3. After the container finishes running, view your fortune:

    sudo kubectl logs cowfortune

Additional Resources

You have just landed a job at a new company, and they want to run some applications on Kubernetes. However, they need the footprint of the Kubernetes infrastructure to be relatively small because resources are limited. K3s would be a good way to meet these needs! As the new Kubernetes expert, it is your job to set up a lightweight K3s cluster. To demonstrate that the cluster works, you will also need to run a sample application in a pod on the new cluster.

You have been provided with three servers. One will be the K3s server, and the other two will be worker nodes.

  • Install K3s and configure the first server as a K3s server.
  • Install K3s and configure the two worker servers as K3s workers.
  • Create a pod on the new cluster with the wernight/funbox image. In the pod, run the command: fortune | cowsay.

Note that the pod should run the command once and then complete. You can use kubectl logs to view the output, which should be a cow speaking a fortune message.

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?