k3s commands
24 commands in 4 groups: Install, Manage, Configure, List & Inspect. Click or tap any command to copy it. Official documentation: docs.k3s.io.
Open in the interactive cheat sheet search, stars and every other section
Install
Install k3s as a single binary. The server (control plane) and agent (worker) modes are selected via subcommands.
curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true sh -
Install binary without starting the service
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=<version> sh -
Install a specific k3s version
curl -sfL https://get.k3s.io | K3S_URL=https://<server>:6443 K3S_TOKEN=<token> sh -
Install k3s agent and join an existing server
curl -sfL https://get.k3s.io | sh -
Install k3s server (control plane + worker)
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --cluster-init" sh -
Install server in HA mode with embedded etcd
Manage
Start, stop, and remove k3s services. Access the embedded kubectl and manage server/agent lifecycle.
/usr/local/bin/k3s-agent-uninstall.sh
Uninstall k3s agent
/usr/local/bin/k3s-uninstall.sh
Uninstall k3s server and all data
systemctl disable k3s
Disable k3s from starting on boot
systemctl enable k3s
Enable k3s to start on boot
/usr/local/bin/k3s kubectl get nodes
Use the embedded kubectl binary
systemctl restart k3s
Restart the k3s server service
k3s server --disable traefik
Start server with specific components disabled
k3s server --disable-agent
Run a control plane with no kubelet (experimental, node is not registered)
systemctl start k3s
Start the k3s server service
systemctl stop k3s
Stop the k3s server service
Configure
Access kubeconfig, retrieve the node token, and configure k3s via environment variables and config files.
mkdir -p $HOME/.kube && cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config && chown $(id -u):$(id -g) $HOME/.kube/config
Copy kubeconfig for kubectl access
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --write-kubeconfig-mode 644" sh -
Install with world-readable kubeconfig
cat /etc/rancher/k3s/config.yaml
View the k3s server config file
cat /etc/rancher/k3s/k3s.yaml
Print the kubeconfig file
cat /var/lib/rancher/k3s/server/node-token
Print the node token (needed for agent join)
List & Inspect
Check k3s version, service status, and running processes.
k3s --version
Print k3s version
journalctl -u k3s -f
Follow k3s server logs
journalctl -u k3s-agent -f
Follow k3s agent logs
systemctl status k3s
Check k3s server service status