Convert Figma logo to code with AI

k3d-io logok3d

Little helper to run CNCF's k3s in Docker

5,337
456
5,337
213

Top Related Projects

27,843

Lightweight Kubernetes

29,325

Run Kubernetes locally

13,406

Kubernetes IN Docker - local clusters for testing Kubernetes

3,731

Aggregator for issues filed against kubeadm

VMware Tanzu Community Edition is no longer an actively maintained project. Code is available for historical purposes only.

MicroK8s is a small, fast, single-package Kubernetes for datacenters and the edge.

Quick Overview

k3d is a lightweight wrapper to run k3s (Rancher Lab's minimal Kubernetes distribution) in Docker. It makes it easy to create single- and multi-node k3s clusters in Docker, enabling rapid local development and testing of Kubernetes applications.

Pros

  • Fast and lightweight setup of Kubernetes clusters
  • Supports multi-node clusters for more realistic testing environments
  • Integrates well with CI/CD pipelines
  • Cross-platform compatibility (Linux, macOS, Windows)

Cons

  • Limited to k3s functionality, which may not fully replicate a production Kubernetes environment
  • Resource intensive for large multi-node clusters on a single machine
  • Some advanced Kubernetes features may not be available or may behave differently

Getting Started

To get started with k3d, follow these steps:

  1. Install k3d:

    wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
    
  2. Create a single-node cluster:

    k3d cluster create mycluster
    
  3. Create a multi-node cluster:

    k3d cluster create mycluster --servers 3 --agents 3
    
  4. Use kubectl to interact with your cluster:

    kubectl get nodes
    
  5. Delete the cluster when you're done:

    k3d cluster delete mycluster
    

These instructions will help you quickly set up and start using k3d for local Kubernetes development and testing.

Competitor Comparisons

27,843

Lightweight Kubernetes

Pros of k3s

  • Lightweight and resource-efficient, suitable for edge computing and IoT devices
  • Fully-featured Kubernetes distribution with built-in components like load balancer and storage
  • Easier to install and manage on bare metal or VMs

Cons of k3s

  • Less flexibility in cluster configuration compared to k3d
  • May require more manual setup for advanced networking or storage scenarios
  • Not as easily integrated with existing Docker environments

Code Comparison

k3s installation:

curl -sfL https://get.k3s.io | sh -

k3d cluster creation:

k3d cluster create mycluster

k3s is a lightweight Kubernetes distribution, while k3d is a tool for running k3s in Docker containers. k3s is designed for production use in resource-constrained environments, whereas k3d is primarily used for local development and testing. k3s provides a more complete Kubernetes experience out-of-the-box, while k3d offers greater flexibility in cluster configuration and integration with Docker workflows.

Both projects aim to simplify Kubernetes deployment and management, but they target different use cases and environments. The choice between k3s and k3d depends on specific requirements, such as production vs. development needs, available resources, and existing infrastructure.

29,325

Run Kubernetes locally

Pros of Minikube

  • More mature and widely adopted, with extensive documentation and community support
  • Supports multiple hypervisors (VirtualBox, KVM, Hyper-V) for broader compatibility
  • Offers a dashboard for easier cluster management and visualization

Cons of Minikube

  • Heavier resource consumption, requiring a full VM for each node
  • Slower startup times compared to k3d's lightweight containers
  • More complex setup process, especially for multi-node clusters

Code Comparison

k3d cluster creation:

k3d cluster create mycluster --servers 1 --agents 2

Minikube cluster creation:

minikube start --nodes 3 -p mycluster

Both k3d and Minikube are tools for creating local Kubernetes clusters, but they differ in their approach and resource usage. k3d uses lightweight containers based on k3s, while Minikube creates full VMs. This makes k3d generally faster and more resource-efficient, especially for development environments.

k3d is ideal for quick, lightweight clusters and CI/CD pipelines, while Minikube offers a more production-like environment with broader compatibility. The choice between them depends on specific use cases, available resources, and desired cluster characteristics.

13,406

Kubernetes IN Docker - local clusters for testing Kubernetes

Pros of kind

  • Officially supported by Kubernetes SIG, ensuring better alignment with Kubernetes development
  • Supports multi-node clusters out of the box, allowing for more complex testing scenarios
  • Provides a more Kubernetes-native experience, closely mimicking production environments

Cons of kind

  • Generally slower to start up compared to k3d
  • Requires more system resources, which can be challenging on resource-constrained machines
  • Less flexible in terms of customization options for cluster creation

Code Comparison

k3d cluster creation:

k3d cluster create mycluster --servers 1 --agents 2

kind cluster creation:

kind create cluster --name mycluster --config kind-config.yaml

Both tools offer straightforward cluster creation, but k3d provides more options directly in the command line, while kind often relies on configuration files for advanced setups.

k3d focuses on simplicity and speed, making it ideal for quick local development and CI/CD pipelines. kind, on the other hand, prioritizes a more production-like environment, making it suitable for thorough testing and development of Kubernetes-native applications.

Ultimately, the choice between k3d and kind depends on specific use cases, resource availability, and the level of Kubernetes fidelity required for the development or testing environment.

3,731

Aggregator for issues filed against kubeadm

Pros of kubeadm

  • Officially supported by Kubernetes, ensuring compatibility and regular updates
  • Provides more control over cluster configuration and customization
  • Suitable for production environments and larger-scale deployments

Cons of kubeadm

  • More complex setup process compared to k3d
  • Requires more system resources and time to set up a cluster
  • Steeper learning curve for beginners

Code Comparison

k3d:

k3d cluster create mycluster

kubeadm:

kubeadm init --pod-network-cidr=10.244.0.0/16
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Summary

k3d is a lightweight tool for creating Kubernetes clusters using k3s, ideal for local development and testing. It offers a simpler setup process and requires fewer resources.

kubeadm is the official Kubernetes cluster bootstrapping tool, providing more control and customization options. It's better suited for production environments and larger-scale deployments but has a steeper learning curve.

Both tools serve different purposes and cater to different use cases within the Kubernetes ecosystem. The choice between them depends on the specific requirements of your project and deployment environment.

VMware Tanzu Community Edition is no longer an actively maintained project. Code is available for historical purposes only.

Pros of community-edition

  • Offers a more comprehensive Kubernetes platform with additional enterprise features
  • Provides a curated set of packages and tools for enterprise-grade Kubernetes deployments
  • Includes built-in support for multi-cluster management and advanced networking options

Cons of community-edition

  • Requires more resources and has a larger footprint compared to k3d
  • Steeper learning curve and potentially more complex setup process
  • May have slower release cycles and updates compared to k3d

Code comparison

k3d:

k3d cluster create mycluster
k3d kubeconfig get mycluster > kubeconfig
export KUBECONFIG=./kubeconfig
kubectl get nodes

community-edition:

tanzu cluster create --file cluster-config.yaml
tanzu cluster kubeconfig get mycluster --admin
export KUBECONFIG=./kubeconfig
kubectl get nodes

While both tools allow for easy cluster creation and management, k3d focuses on lightweight, local Kubernetes clusters, whereas community-edition provides a more feature-rich platform for enterprise use cases. k3d is ideal for development and testing, while community-edition is better suited for production-ready environments with advanced requirements.

MicroK8s is a small, fast, single-package Kubernetes for datacenters and the edge.

Pros of MicroK8s

  • Full-featured Kubernetes distribution with built-in add-ons
  • Supports multi-node clusters for production-like environments
  • Officially supported by Canonical with regular updates

Cons of MicroK8s

  • Heavier resource usage compared to k3d
  • Slower startup time and potentially more complex setup
  • Limited to Linux and requires snap package manager

Code Comparison

MicroK8s installation:

sudo snap install microk8s --classic
microk8s status --wait-ready
microk8s kubectl get all --all-namespaces

k3d cluster creation:

k3d cluster create mycluster
kubectl get nodes

Both k3d and MicroK8s aim to provide lightweight Kubernetes environments, but they differ in their approach and target use cases. k3d focuses on running k3s clusters in Docker containers, making it extremely lightweight and fast to spin up. It's ideal for local development and testing.

MicroK8s, on the other hand, is a more comprehensive Kubernetes distribution that can be used for both development and small-scale production deployments. It offers a wider range of features out of the box but requires more resources and has a steeper learning curve.

The choice between k3d and MicroK8s depends on your specific needs, such as resource constraints, desired features, and target environment.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

k3d

License Downloads

Go Module Go version Go Report Card

All Contributors

Contributor Covenant

k3s in docker

k3s is the lightweight Kubernetes distribution by Rancher: k3s-io/k3s

k3d creates containerized k3s clusters. This means, that you can spin up a multi-node k3s cluster on a single machine using docker.

asciicast

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:

Learning

Requirements

  • docker
    • Note: k3d v5.x.x requires at least Docker v20.10.5 (runc >= v1.0.0-rc93) to work properly (see #807)

Releases

  • May 2020: v1.7.x -> v3.0.0 (rewrite)
  • January 2021: v3.x.x -> v4.0.0 (breaking changes)
  • September 2021: v4.4.8 -> v5.0.0 (breaking changes)
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--
Scoopstablescoop--

Get

You have several options there:

  • use the install script to grab the latest release:

    • 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
  • use Homebrew: brew install k3d (Homebrew is available for MacOS and Linux)

  • install via MacPorts: sudo port selfupdate && sudo port install k3d (MacPorts is available for MacOS)

  • install via AUR package rancher-k3d-bin: yay -S rancher-k3d-bin

  • grab a release from the release tab and install it yourself.

  • install via go: go install github.com/k3d-io/k3d/v5@latest (Note: this will give you unreleased/bleeding-edge changes)

  • use Chocolatey: choco install k3d (Chocolatey package manager is available for Windows)

  • use Scoop: scoop install k3d (Scoop package manager is available for Windows)

or...

Build

  1. Clone this repo, e.g. via git clone git@github.com:k3d-io/k3d.git or go get github.com/k3d-io/k3d/v5@main
  2. Inside the repo run
    • 'make install-tools' to make sure required go packages are installed
  3. Inside the repo run one of the following commands
    • make build to build for your current system
    • go install to install it to your GOPATH (Note: this will give you unreleased/bleeding-edge changes)
    • make build-cross to build for all systems

Usage

Check out what you can do via k3d help or check the docs @ k3d.io

Example Workflow: Create a new cluster and use it with kubectl

  1. k3d cluster create CLUSTER_NAME to create a new single-node cluster (= 1 container running k3s + 1 loadbalancer container)
  2. [Optional, included in cluster create] k3d kubeconfig merge CLUSTER_NAME --kubeconfig-switch-context to update your default kubeconfig and switch the current-context to the new one
  3. execute some commands like kubectl get pods --all-namespaces
  4. k3d cluster delete CLUSTER_NAME to delete the default cluster

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

History

This repository is based on @zeerorg's zeerorg/k3s-in-docker, reimplemented in Go by @iwilltry42 in iwilltry42/k3d, which got adopted by Rancher in rancher/k3d and was now moved into its own GitHub organization at k3d-io/k3d.

Related Projects

  • k3x: GUI (Linux) to k3d
  • vscode-k3d: vscode plugin for 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.

Contributing

k3d is a community-driven project and so we welcome contributions of any form, be it code, logic, documentation, examples, requests, bug reports, ideas or anything else that pushes this project forward.

Please read our Contributing Guidelines and the related Code of Conduct.

You can find an overview of the k3d project (e.g. explanations and a repository guide) in the documentation: k3d.io/stable/design/project/

Contributor Covenant

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Thorsten Klein
Thorsten Klein

💻 📖 🤔 🚧
Rishabh Gupta
Rishabh Gupta

🤔 💻
Louis Tournayre
Louis Tournayre

📖
Lionel Nicolas
Lionel Nicolas

💻
Toon Sevrin
Toon Sevrin

💻
Dennis Hoppe
Dennis Hoppe

📖 💡
Jonas Dellinger
Jonas Dellinger

🚇
markrexwinkel
markrexwinkel

📖
Alvaro
Alvaro

💻 🤔 🔌
Nuno do Carmo
Nuno do Carmo

🖋 ✅ 💬
Erwin Kersten
Erwin Kersten

📖
Alex Sears
Alex Sears

📖
Mateusz Urbanek
Mateusz Urbanek

💻
Benjamin Blattberg
Benjamin Blattberg

💻
Simon Baier
Simon Baier

💻
Ambrose Chua
Ambrose Chua

💻
Erik Godding Boye
Erik Godding Boye

💻
York Wong
York Wong

💻
Raul Gonzales
Raul Gonzales

💻 📖
Sunghoon Kang
Sunghoon Kang

💻
Kamesh Sampath
Kamesh Sampath

💻
Arik Maor
Arik Maor

💻 ✅ 💡
Danny Gershman
Danny Gershman

💻
stopanko
stopanko

💵
Danny Breyfogle
Danny Breyfogle

📖
Ahmed AbouZaid
Ahmed AbouZaid

🤔 💻 📖
Pierre Roudier
Pierre Roudier

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Sponsors

Thanks to all our amazing sponsors! 🙏