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:
Cluster Metadata: The name of the cluster (
microservice-cluster
).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
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
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
Create a k0sctl configuration file (as shown above) and save it as
k0sctl.yaml
.Apply the configuration to create or update the cluster:
Verify the cluster status:
Accessing the Cluster
After deploying the cluster, k0sctl can generate a kubeconfig file for accessing it:
Now you can use kubectl to interact with your cluster:
Upgrading the Cluster
To upgrade a k0s cluster:
Update the version in your k0sctl.yaml file:
Apply the updated configuration:
Resetting the Cluster
If you need to reset the cluster:
This will uninstall k0s from all hosts defined in the configuration.