Lab Setup
Info
All labs are stored in a separate Github repository – k8s-guide-labs
Prerequisites
In order to interact with the lab, the following set of tools need to be pre-installed:
- Docker with
containerdruntime. 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.
Info
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.
Note
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:
To view the list of available operations do:
Check and install the required prerequisites:
Setup the lab environment with:
Finally, bootstrap the cluster with Flux:
Tip
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:
In order to stop the cluster (e.g. to free up resources) run:
In order to rebuild the cluster (combined up and down) run:
To completely destroy the lab environment, including the caching registry run:
Default applications
The lab cluster is setup with a couple of applications that will be used throughout this guide:
- Weave Scope – a tool to visualise and monitor Kubernetes cluster workloads.
Tip
To connect to Weave Scope’s front-end, run make connect and go to http://localhost:8080
- netshoot – deployed as a Daemonset, a docker image pre-installed with a wide range of network troubleshooting tools.
Tip
To connect to a Pod running on a particular Node (e.g. k8s-guide-worker), run NODE=k8s-guide-worker make tshoot