Overview¶
-This page is targeting k3d v4.0.0 and newer!
-k3d is a lightweight wrapper to run k3s (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.
-View a quick demo
Learning¶
-k3d demo repository: iwilltry42/k3d-demo
-Featured use-cases include:
--
-
- hot-reloading of code when developing on k3d (Python Flask App) -
- build-deploy-test cycle using Tilt -
- full cluster lifecycle for simple and multi-server clusters -
- Proof of Concept of using k3d as a service in Drone CI -
Requirements¶
--
-
- docker -
Releases¶
-| Platform | -Stage | -Version | -Release Date | -- |
|---|---|---|---|---|
| GitHub Releases | -stable | -- | ||
| GitHub Releases | -latest | -- | ||
| Homebrew | -- | -- | -- | |
| Chocolatey | -stable | -- | -- |
Installation¶
-You have several options there:
-Install Script¶
-Install current latest release¶
--
-
- wget:
wget -q -O - https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
- - curl:
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
-
Install specific release¶
-Use the install script to grab a specific release (via TAG environment variable):
-
-
- wget:
wget -q -O - https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=v4.0.0 bash
- - curl:
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=v4.0.0 bash
-
Other Installers¶
-Other Installation Methods
-
-
-
-
Homebrew (MacOS/Linux):
-brew install k3dNote: The formula can be found in homebrew/homebrew-core and is mirrored to homebrew/linuxbrew-core
-
-
-
-
-
-
AUR (Arch Linux User Repository):
-yay -S rancher-k3d-binPackage rancher-k3d-bin
-
-
-
-
-
-
-
Grab a release binary from the release tab and install it yourself
-
-
-
-
-
-
Chocolatey (Windows):
-choco install k3dNote: package source can be found in erwinkersten/chocolatey-packages
-
-
-
-
- arkade:
arkade get k3d
-
-
-
-
-
asdf:
-asdf plugin-add k3d && asdf install k3d latestNote:
-asdf plugin-add k3d, thenasdf install k3d <tag>with<tag> = latestor4.x.xfor a specific version (maintained by spencergilbert/asdf-k3d)
-
-
-
- Others
-
-
- install via go:
go install github.com/rancher/k3d@latest(Note: this will give you unreleased/bleeding-edge changes)
-
- - install via go:
Quick Start¶
-Create a cluster named mycluster with just a single server node:
k3d cluster create mycluster
-Use the new cluster with kubectl, e.g.:
kubectl get nodes
-Getting the cluster’s kubeconfig (included in k3d cluster create)
Get the new cluster’s connection details merged into your default kubeconfig (usually specified using the KUBECONFIG environment variable or the default path $HOME/.kube/config) and directly switch to the new context:
k3d kubeconfig merge mycluster --kubeconfig-switch-context
-Related Projects¶
--
-
- vscode-k3d: VSCode Extension to handle k3d clusters from within VSCode -
- k3x: a graphics interface (for Linux) to k3d. -
- AbsaOSS/k3d-action: fully customizable GitHub Action to run lightweight Kubernetes clusters. -
- AutoK3s: a lightweight tool to help run K3s everywhere including k3d provider. -
- nolar/setup-k3d-k3s: setup K3d/K3s for GitHub Actions. -
-