Microservices Docs Help

k0s and k0sctl

This document provides information about k0s, a lightweight Kubernetes distribution, and k0sctl, a tool for managing k0s clusters.

Overview

k0s is a complete Kubernetes distribution packaged as a single binary, designed to be simple to install and operate.

k0sctl is a command-line tool that helps deploy and manage k0s clusters across multiple nodes. It uses SSH to connect to the target hosts and automates the installation and configuration of k0s.

Prerequisites

Before you begin, ensure that:

  • You have at least one server for a single-node setup or multiple servers for a multi-node cluster

  • Each server has at least 1 CPU, 1GB RAM, and 10GB disk space

  • All servers have static IP addresses and can communicate with each other

  • You have SSH access to all servers

  • All servers have unique hostnames

k0sctl Configuration

The k0sctl tool uses a YAML configuration file to define the cluster.

Configuration Explanation

The configuration file defines:

  1. Cluster Metadata: The name of the cluster (microservice-cluster).

  2. Hosts: The servers that will form the cluster:

    • A controller node at 5.75.129.76

    • Two controller+worker nodes at 185.229.90.248 and 91.99.143.250

    • Each host has SSH connection details including address, user, port, and SSH key path

  3. k0s Configuration:

    • Version: v1.33.2+k0s.0

    • Network configuration with node local load balancing enabled using EnvoyProxy

    • Storage type set to etcd

    • Telemetry enabled

  4. Options:

    • Wait for operations to complete

    • Drain settings for node maintenance

    • Concurrency settings for parallel operations

    • Eviction taint configuration

Deploying a k0s Cluster with k0sctl

  1. Create a k0sctl configuration file (as shown above) and save it as k0sctl.yaml.

  2. Apply the configuration to create or update the cluster:

k0sctl apply --config k0sctl.yaml
  1. Verify the cluster status:

k0sctl kubectl get nodes k0sctl kubectl get pods -A

Accessing the Cluster

After deploying the cluster, k0sctl can generate a kubeconfig file for accessing it:

k0sctl kubeconfig --config k0sctl.yaml > ~/.kube/config kubectl get nodes kubectl get pods -A

Now you can use kubectl to interact with your cluster:

kubectl get nodes kubectl get pods -A

Upgrading the Cluster

To upgrade a k0s cluster:

  1. Update the version in your k0sctl.yaml file:

k0s: version: v1.33.3+k0s.0 # New version
  1. Apply the updated configuration:

k0sctl apply --config k0sctl.yaml

Resetting the Cluster

If you need to reset the cluster:

k0sctl reset --config k0sctl.yaml

This will uninstall k0s from all hosts defined in the configuration.

Last modified: 10 July 2025