Step 2: Kubernetes Cluster
In this step, we will setup a Kubernetes cluster using Docker Desktop
or kind
.
Optionally if you have a Kubernetes cluster already, you can skip this step.
By the end of this tutorial you should be able to run kubectl get nodes
and see a list of nodes.
Please follow any one of the following sections to setup a Kubernetes cluster.
2.1) Setup with Docker Desktop
Docker Desktop includes a standalone Kubernetes server and client, as well as Docker CLI integration that runs on your machine.
Enable kubernetes
To enable Kubernetes in Docker Desktop:
- From the Docker Dashboard, select the Settings.
- Select Kubernetes from the left sidebar.
- Next to Enable Kubernetes, select the checkbox.
- Select Apply & Restart to save the settings and then click Install to confirm.
Note: You might want to increase the memory and cpu allocated to the cluster, in Settings, Resources
Connect with kubectl
# list of all the contexts
kubectl config get-contexts
# set the context to docker-desktop
kubectl config use-context docker-desktop
Detailed Reference: https://docs.docker.com/desktop/kubernetes/ (opens in a new tab)
2.2) Check Access to kubernetes
Once you are connected to a kubernetes cluster, you should be able to run the following command and see a list of nodes.
kubectl get nodes