Quick Start Guide - Documentation (original) (raw)

Completing this Quick Start results in a single-node Kubernetes cluster that incorporates both the controller and worker roles. This setup is ideal for environments that don't require high availability or multiple nodes.

Prerequisites#

Note: Before proceeding, make sure to review the System Requirements.

The following steps work on every typical Linux distribution that uses either systemd or OpenRC as its init system.

Install k0s#

  1. Download k0s
    Run the k0s download script to download the latest stable version of k0s and make it executable from /usr/local/bin/k0s.
    curl --proto '=https' --tlsv1.2 -sSf https://get.k0s.sh | sudo sh
    Alternatively, download it from the k0s releases page. This approach is required in air gapped environments.
  2. Install k0s as a service
    The k0s install sub-command installs k0s as a system service on a host that is running one of the supported init systems: systemd or OpenRC. You can execute the install for workers, controllers or single node (controller+worker) instances.
    Run the following command to install a single node k0s that includes the controller and worker functions with the default configuration:
    sudo k0s install controller --single
    Note: The --single option disables features needed for multi-node clusters, so the cluster cannot be extended. To retain the ability to expand the cluster in the future, use:
    sudo k0s install controller --enable-worker --no-taints
    The k0s install controller sub-command accepts the same flags and parameters as the k0s controller. Refer to manual install for a custom config file example.
    It is possible to set environment variables with the install command:
    sudo k0s install controller -e ETCD_UNSUPPORTED_ARCH=arm
    The system service can be reinstalled with the --force flag:
    sudo k0s install controller --single --force sudo systemctl daemon-reload
  3. Start k0s as a service
    To start the k0s service, run:
    The k0s service will start automatically after the node restart.
    A minute or two typically passes before the node is ready to deploy applications.
  4. Check service, logs and k0s status
    Run the following command to check the k0s instance status:
    $ sudo k0s status Version: v1.34.2+k0s.0 Process ID: 436 Role: controller Workloads: true Init System: linux-systemd
  5. Access the cluster using kubectl
    Note: k0s embeds the Kubernetes command-line tool kubectl.
    Use kubectl to deploy applications or check node status:
    `$ sudo k0s kubectl get nodes
    NAME STATUS ROLES AGE VERSION
    k0s Ready 4m6s v1.34.2+k0s

`

Uninstall k0s#

The removal of k0s is a two-step process.

  1. Stop the service.
  2. Execute the k0s reset command.
    The k0s reset command cleans up the installed system service, data directories, containers, mounts and network namespaces.
  3. Reboot the system.
    A few small k0s fragments persist even after the reset, such as iptables rules. Reboot the machine after running k0s reset.

Next Steps#