k3s
Run lightweight Kubernetes clusters
TLDR
Run the embedded kubectl command
Take an etcd snapshot of the cluster
Rotate the CA certificate
Manage bootstrap tokens
Uninstall K3s and remove all components
SYNOPSIS
k3s server [OPTIONS]
k3s agent [OPTIONS]
k3s kubectl [COMMAND]
k3s crictl [COMMAND]
k3s ctr [COMMAND]
k3s etcd-snapshot [COMMAND]
k3s check-config [OPTIONS]
k3s install
k3s uninstall
k3s -v | --version
k3s -h | --help
PARAMETERS
--version
Show version information and exit.
--help, -h
Show help message for the command or subcommand.
--debug
Enable debug logging output.
--config <path>
Specify the configuration file path to load.
--token <token>
Shared secret token used to join agents or additional servers to the cluster.
--cluster-cidr <CIDR>
CIDR for the Kubernetes cluster network (server only).
--service-cidr <CIDR>
CIDR for Kubernetes services (server only).
--datastore-endpoint <endpoint>
Database connection string for an external datastore (e.g., SQLite, PostgreSQL, MySQL; server only).
--disable <component>
Disable a bundled component, e.g., 'traefik', 'local-storage', 'metrics-server', 'servicelb' (server only).
--node-name <name>
Specify the name of the node (server or agent).
--node-ip <ip>
Specify the IP address of the node (server or agent).
--server <url>
URL of the K3s server to connect to (agent only).
--label <key=value>
Add a label to the node (agent only).
--taint <key=value:effect>
Add a taint to the node (agent only).
DESCRIPTION
k3s is a highly available, certified Kubernetes distribution designed for production workloads in resource-constrained environments. Developed by Rancher Labs, it packages a complete Kubernetes cluster into a single, small binary, making it ideal for edge computing, IoT devices, CI/CD pipelines, and development environments. It significantly reduces the operational overhead by bundling essential components like containerd, Flannel, CoreDNS, and a lightweight embedded SQLite datastore, yet offers the flexibility to use external datastores like PostgreSQL or MySQL. Its minimal footprint and ease of installation make it a popular choice for deploying Kubernetes where traditional distributions might be too heavy or complex.
CAVEATS
While k3s is highly capable for its intended use cases, it's not a drop-in replacement for full-fledged Kubernetes distributions in all scenarios. Its design prioritizes lightness and ease of use, which means some advanced or highly customized features found in upstream Kubernetes might be simplified or require additional configuration. Specifically, it bundles certain components (like Traefik for Ingress, or Flannel for CNI), which are convenient but might limit flexibility if you prefer other solutions out-of-the-box. Users should also be mindful of resource constraints on the target hardware, as even a lightweight Kubernetes still requires a certain baseline of CPU and memory.
INSTALLATION
k3s is typically installed via a single command, which downloads and installs the binary as a system service. For example, to install the server:
curl -sfL https://get.k3s.io | sh -
This simplicity is a core aspect of its design, enabling rapid deployment on various Linux distributions.
BUNDLED TOOLS
One of the key features of k3s is its bundling of essential Kubernetes tools directly within the single k3s binary. This includes kubectl, crictl, and ctr. Users can execute these tools by prefixing them with k3s (e.g., k3s kubectl get nodes), eliminating the need for separate installations and ensuring version compatibility with the running k3s cluster.
HISTORY
k3s was first released by Rancher Labs (now part of SUSE) in February 2019. Its creation was driven by the increasing demand for Kubernetes in edge and IoT environments, where traditional Kubernetes distributions were often too resource-intensive and complex to deploy. The project quickly gained traction due to its innovative approach of bundling core components into a single, small binary, simplifying installation and management significantly. Its design principle focuses on being a "lightweight, certified Kubernetes," ensuring compatibility with upstream Kubernetes APIs while minimizing footprint and dependencies. It has since become one of the most popular choices for deploying Kubernetes in non-traditional data center settings.