Overview

k3d

What is k3d?

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:

- GitHub Sponsors: GitHub Sponsors - LiberaPay: Liberapay patrons - IssueHunt: https://issuehunt.io/r/k3d-io/k3d

View a quick demo

Learning

k3d demo repository: iwilltry42/k3d-demo

Featured use-cases include:

Requirements

  • 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

Releases

PlatformStageVersionRelease DateDownloads so far
GitHub ReleasesstableGitHub release (latest by date)GitHub Release DateGitHub Release Downloads
GitHub ReleaseslatestGitHub release (latest by date including pre-releases)GitHub (Pre-)Release DateGitHub Release Downloads (incl. Pre-Releases)
Homebrewstablehomebrew--
Chocolateystablechocolatey--

Installation

You have several options there:

Overview - 图12 Install Script

Install current latest release

  • wget:

    1. wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
  • curl:

    1. curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash

Install specific release

Use the install script to grab a specific release (via TAG environment variable):

  • wget:

    1. wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.0.0 bash
  • curl:

    1. curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.0.0 bash

Other Installers

Other Installation Methods

Quick Start

Create a cluster named mycluster with just a single server node:

  1. k3d cluster create mycluster

Use the new cluster with kubectl, e.g.:

  1. 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:

  1. k3d kubeconfig merge mycluster --kubeconfig-switch-context

Connect

  1. Join the Rancher community on slack via slack.rancher.io
  2. Go to rancher-users.slack.com and join our channel #k3d
  3. 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.

Last update: July 31, 2022