k3d
k3d is a lightweight wrapper to run k3s5 (Rancher Lab’s minimal Kubernetes distribution) in docker. k3d makes it very easy to create single- and multi-node k3s clusters in docker, e.g. for local development on Kubernetes.
Prerequisites
- To use k3d, you will also need to install docker6.
- Install the latest version of k3d.
- To interact with the Kubernetes cluster kubectl
- (Optional) Helm7 is the package manager for Kubernetes
Installation
Create a cluster and disable
Traefik
with the following command:To see the list of k3d clusters, use the following command:
To list the local Kubernetes contexts, use the following command.
If you run multiple clusters, you need to choose which cluster
kubectl
talks to. You can set a default cluster forkubectl
by setting the current context in the Kubernetes kubeconfig8 file. Additionally you can run following command to set the current context forkubectl
.
Set up Istio for k3d
Once you are done setting up a k3d cluster, you can proceed to install Istio with Helm 39 on it.
(Optional) Install an ingress gateway:
Set up Dashboard UI for k3d
k3d does not have a built-in Dashboard UI like minikube. But you can still set up Dashboard, a web based Kubernetes UI, to view your cluster. Follow these instructions to set up Dashboard for k3d.
To deploy Dashboard, run the following command:
Verify that Dashboard is deployed and running.
Create a
ServiceAccount
andClusterRoleBinding
to provide admin access to the newly created cluster.To log in to your Dashboard, you need a Bearer Token. Use the following command to store the token in a variable.
Display the token using the
echo
command and copy it to use for logging in to your Dashboard.You can access your Dashboard using the kubectl command-line tool by running the following command:
Click Kubernetes Dashboard10 to view your deployments and services.
Uninstall
When you are done experimenting and you want to delete the existing cluster, use the following command: