Lab Setup

All labs are stored in a separate Github repository – k8s-guide-labs


In order to interact with the lab, the following set of tools need to be pre-installed:

  • Docker with containerd runtime. This is what you get by default when you install docker-ce.
  • kubectl to interact with a Kubernetes cluster. Installation instructions can be found here.
  • helm to bootstrap the cluster with Flux. Installation instructions can be found here
  • make is used to automate and orchestrate manual tasks. Most instructions will be provided as a series of make commands.

A number of additional tools (e.g. kind) will be installed automatically during the Setup phase

Some optional extras that may make your life a lot easier:

  • kubectl and docker commands auto-completion.
  • kubens/kubectx to easily switch between namespaces and contexts.
  • stern to read logs from multiple Pods at the same time.
  • k9s is a very convinient terminal dashboard for a Kubernetes cluster.

Installation instructions will depend on the operating system. Here’s an example bash bootstrap script for Ubuntu 20.4 LTS x86_64.

Supported Operating Systems

The main supported operating system is Linux. The kernel version can be anything that’s >=4.19.

Most of the things should also be supported on Darwin. If you find a discrepancy and know how to fix it, please submit a PR.

Setup instructions

Clone the k8s-guide-labs repository:

git clone && cd k8s-guide-labs

To view the list of available operations do:

$ make  

check           Check prerequisites 
setup           Setup the lab environment 
up              Bring up the cluster 
connect         Connect to Weave Scope 
tshoot          Connect to the troubleshooting pod 
reset           Reset k8s cluster 
down            Shutdown 
cleanup         Destroy the lab environment 

Check and install the required prerequisites:

$ make check
all good

Setup the lab environment with:

make setup

Finally, bootstrap the cluster with Flux:

make up

All labs are built in GitOps style using Flux as the controller that manages the state of the cluster.

Interacting with the Lab

The lab consists of a local Kubernetes cluster along with a caching pull-through Docker registry to speed up download times. The cluster is built with kind and the caching registry is a standalone container running alongside of it.

To build the cluster for the first time run:

make up

In order to stop the cluster (e.g. to free up resources) run:

make down

In order to rebuild the cluster (combined up and down) run:

make reset

To completely destroy the lab environment, including the caching registry run:

make cleanup

Default applications

The lab cluster is setup with a couple of applications that will be used throughout this guide:

  1. Weave Scope – a tool to visualise and monitor Kubernetes cluster workloads.

To connect to Weave Scope’s front-end, run make connect and go to http://localhost:8080

  1. netshoot – deployed as a Daemonset, a docker image pre-installed with a wide range of network troubleshooting tools.

To connect to a Pod running on a particular Node (e.g. k8s-guide-worker), run NODE=k8s-guide-worker make tshoot