The Install Script

A single curl command downloads k3s, installs it, and starts it as a system service.

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

The fastest way to get k3s is the official install script hosted at get.k3s.io. It detects your OS and CPU architecture, installs the binary, and registers a systemd (or OpenRC) service so k3s starts on boot.

What the script does

  1. Downloads the correct k3s binary.
  2. Installs it to /usr/local/bin/k3s.
  3. Creates kubectl, crictl, and ctr symlinks.
  4. Writes and enables the k3s service.
  5. Starts a single-node cluster immediately.

You can pass options to the script in two ways: environment variables prefixed with INSTALL_K3S_, or flags placed after sh -s - which go straight to k3s server.

Example

Example · bash
# Simplest install (single-node server)
curl -sfL https://get.k3s.io | sh -

# Pin a specific version and pass a server flag
curl -sfL https://get.k3s.io | \
  INSTALL_K3S_VERSION=v1.30.5+k3s1 \
  sh -s - --write-kubeconfig-mode 644

# Verify
sudo systemctl status k3s
kubectl get nodes

When to use it

  • A developer bootstraps a disposable test cluster on a fresh Ubuntu VM using a single curl command with no additional configuration.
  • An ops team uses environment variables in the install command to pin a specific k3s version across all production servers.
  • A systemd-based server automatically starts k3s after every reboot because the install script registers a systemd service by default.

More examples

Basic install with curl

Runs the official installer which downloads the binary, registers a systemd service, and starts k3s immediately.

Example · bash
curl -sfL https://get.k3s.io | sh -
systemctl status k3s

Pin a specific k3s version

Sets INSTALL_K3S_VERSION to lock the cluster to an exact release, ensuring reproducible environments.

Example · bash
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.29.3+k3s1 sh -
k3s --version

Install without starting the service

Downloads and installs the k3s binary and scripts without activating the systemd service, useful for pre-provisioning.

Example · bash
curl -sfL https://get.k3s.io | \
  INSTALL_K3S_SKIP_START=true \
  INSTALL_K3S_SKIP_ENABLE=true \
  sh -
ls /usr/local/bin/k3s

Discussion

  • Be the first to comment on this lesson.