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.
Note: k3d is a community-driven project but it's not an official Rancher (SUSE) product. Sponsoring: To spend any significant amount of time improving k3d, we rely on sponsorships:
??? Tip "View a quick demo"
!!! Tip "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**
- docker to be able to use k3d at all
- Note: k3d v5.x.x requires at least Docker v20.10.5 (runc >= v1.0.0-rc93) to work properly (see #807)
- kubectl to interact with the Kubernetes cluster
Platform | Stage | Version | Release Date | Downloads so far |
---|---|---|---|---|
GitHub Releases | stable | |||
GitHub Releases | latest | |||
Homebrew | stable | - | - | |
Chocolatey | stable | - | - | |
Scoop | stable | - | - |
You have several options there:
-
wget:
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
-
curl:
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
Use the install script to grab a specific release (via TAG
environment variable):
-
wget:
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.0.0 bash
-
curl:
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.0.0 bash
??? Tip "Other Installation Methods"
- [:fontawesome-solid-beer: Homebrew (MacOS/Linux)](https://brew.sh):
```bash
brew install k3d
```
*Note*: The formula can be found in [homebrew/homebrew-core](https://github.com/Homebrew/homebrew-core/blob/master/Formula/k3d.rb) and is mirrored to [homebrew/linuxbrew-core](https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/k3d.rb)
- [:material-arch: AUR (Arch Linux User Repository)](https://aur.archlinux.org/):
```bash
yay -S rancher-k3d-bin
```
Package [rancher-k3d-bin](https://aur.archlinux.org/packages/rancher-k3d-bin/)
- [:material-github: Download GitHub Release](https://github.com/k3d-io/k3d/releases)
Grab a release binary from the [release tab](https://github.com/k3d-io/k3d/releases) and install it yourself
- [:material-microsoft-windows: Chocolatey (Windows)](https://chocolatey.org/): `choco install k3d`
*Note*: package source can be found in [erwinkersten/chocolatey-packages](https://github.com/erwinkersten/chocolatey-packages/tree/master/automatic/k3d)
- [:material-microsoft-windows: Scoop (Windows)](https://scoop.sh//): `scoop install k3d`
*Note*: package source can be found in [ScoopInstaller/Main](https://github.com/ScoopInstaller/Main/blob/master/bucket/k3d.json)
- [arkade](https://github.com/alexellis/arkade): `arkade get k3d`
- [asdf](https://asdf-vm.com): `asdf plugin-add k3d && asdf install k3d latest`
*Note*: `asdf plugin-add k3d`, then `asdf install k3d <tag>` with `<tag> = latest` or `5.x.x` for a specific version (maintained by [spencergilbert/asdf-k3d](https://github.com/spencergilbert/asdf-k3d))
- Others
- install via go: `#!bash go install github.com/k3d-io/k3d/v5@latest` (**Note**: this will give you unreleased/bleeding-edge changes)
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
??? Note "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 #!bash $HOME/.kube/config
) and directly switch to the new context:
```bash
k3d kubeconfig merge mycluster --kubeconfig-switch-context
```
- Join the Rancher community on slack via slack.rancher.io
- Go to rancher-users.slack.com and join our channel #k3d
- Start chatting
- 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.