This is a high level guide that can help new-comers get started with Kubernetes, also known as K8s. The aim of this post is to serve as a compass or a map rather than get into the nitty gritty details for each section. For more details on any of the sections below, one can easily search the internet. I just find it very useful to understand the big picture first rather than getting overwhelmed with details at first.
Installing Kubernetes Locally
It goes without saying that docker is a pre-requisite to K8s. You have to have docker running locally on your machine.
Docker Desktop for Windows (or Docker Desktop for Mac): This is by far the simplest approach. For Windows, I highly recommend enabling the Windows Subsystem for Linux and enabling Docker’s integration with it. Once Docker Desktop is running locally, Kubernetes can be enabled. It can be downloaded from https://docs.docker.com/docker-for-windows/install/ for Windows and https://hub.docker.com/editions/community/docker-ce-desktop-mac for Mac. This option is not available for Linux, but there are plenty of other options below.
MiniKube: This used to be the most popular option before Docker Desktop matured and because more feature rich. It is still a great option. However, you are limited to two pods by design, which can be an issue. It is pretty straightforward to setup. You can see this link for more details. https://minikube.sigs.k8s.io/docs/start/
Kind: pronounced /kīnd/ link the word for good-natured. If you are well-versed with docker containers, Kind is a great option. It might sound strange at first, but Kind runs Kubernetes in a Docker container. I highly recommend it for Linux users as well as WSL2 and Mac users. It does require more knowledge with Docker though, especially that accessing the network outside of the cluster can be complicated. See link: https://kind.sigs.k8s.io/
Kubeadm: Using Kubeadm would be installing Kubernetes “the hard way”. I do not recommend this option if you are starting with Kubernetes. I only recommend experimenting with it if you are interesting in understanding how a self-managed Kubernetes cluster is setup. You will need a minimum of a master node and a one worker node. See Link: https://kubernetes.io/docs/reference/setup-tools/kubeadm/
K3s: I am only listing this option to bring awareness. It is a new solution, but it is geared towards minimal deployments for small embedded devices and other IoT systems. Their website specifies that it is optimized for ARM. It is my understanding that there are features that are still missing. See Link: https://k3s.io/
Using the Kubernetes Command-Line Interface
Now that you have a local cluster provisioned, you need a way to interact with it. The best and recommended way is to use the popular Kubernetes Command-Line Interface (CLI) know as Kubectl. Follow the steps detailed here https://kubernetes.io/docs/tasks/tools/ to install Kubectl on your local machine. If you are on Windows and use Chocolatey you can simply run the command
choco install kubernetes-cli
Once you have Kubectl installed and added to your path, you can start interacting with your cluster. The first and foremost step is the ensure your kubectl client is pointing to the desired cluster. This is important in case you have multiple Kubernetes clusters registered on your machine. To get a list of all clusters, run the following command
kubectl config get-contexts
You should get a list of clusters (typically one if you just installed Kubernetes). Not the “*” under the “CURRENT” column. This indicates the cluster to which kubectl is pointing to
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* docker-desktop docker-desktop docker-desktop
kind-local kind-local kind-local
It really helps to have a dashboard with visual indicators to understand the state of your cluster. You can enable the Kubernetes Dashboard and it will give you a good insight about what is going on in your cluster. Kubernetes already have great instructions in this link: https://github.com/kubernetes/dashboard
You will also need to create the user and the cluster role binding. For that you can follow the second link below, which also reference in the previous link:
Once done, you will end up with an instance of the Kubernetes Dashboard running on your local cluster. It should look something like this:
If you followed the steps above, you should end up with your own local instances of Kubernetes running on your development machine. Also, you should be able to monitor the status of the cluster using the dashboard. You will also be able to utilize the Kubectl utility to interface with the cluster. This barely scratches the surface, and there is lots more to learn. I cannot fit everything is one article, so I will save the rest to future parts. I will cover namespaces, pods, services, deployments in Part 2. I will also cover Helm charts, Istio, Service Meshes and monitoring using Grafana and other tools in future parts as well.