k0s - Lightweight Kubernetes

Status: Active
Last Updated: 2026-01-30
Category: Containers - Orchestration
Prerequisites: orchestration-need, docker-basics
Time: 2-3 hours
Tags: kubernetes, k0s, orchestration, cluster, containers

Summary

Learn k0s, a lightweight Kubernetes distribution with minimal dependencies and simple installation. Master single-node and multi-node cluster setup, understand k0s architecture, and deploy your first applications on Kubernetes without the complexity of traditional distributions.

๐ŸŽฏ What You'll Learn

By the end of this article, you'll be able to:

๐Ÿค” What is k0s?

Kubernetes Made Simple

Traditional Kubernetes:

k0s Philosophy:


k0s Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              k0s Controller Node                โ”‚
โ”‚                                                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚         Control Plane                     โ”‚  โ”‚
โ”‚  โ”‚  - API Server                             โ”‚  โ”‚
โ”‚  โ”‚  - Scheduler                              โ”‚  โ”‚
โ”‚  โ”‚  - Controller Manager                     โ”‚  โ”‚
โ”‚  โ”‚  - etcd (embedded)                        โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                                                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚         Worker Components                 โ”‚  โ”‚
โ”‚  โ”‚  - kubelet                                โ”‚  โ”‚
โ”‚  โ”‚  - containerd                             โ”‚  โ”‚
โ”‚  โ”‚  - kube-proxy                             โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              k0s Worker Nodes                    โ”‚
โ”‚  (Optional - for multi-node clusters)            โ”‚
โ”‚                                                  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  - kubelet                                โ”‚   โ”‚
โ”‚  โ”‚  - containerd                             โ”‚   โ”‚
โ”‚  โ”‚  - kube-proxy                             โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ†š k0s vs Other K8s Distributions

Feature k0s k3s microk8s kubeadm
Binary Size ~180MB ~70MB ~200MB Multiple
Dependencies Zero Zero snapd Many
Installation Single binary Single binary Snap Complex
Memory (min) 1GB 512MB 540MB 2GB
Use Case All Edge/IoT Ubuntu DIY
Managed etcd โœ… โœ… โœ… โŒ
Modular โœ… Limited Limited โœ…
Complexity Low Low Low High

๐Ÿ”ง Prerequisites

System Requirements

Minimum (single-node dev):

Recommended (production):


Supported Operating Systems


๐Ÿ“ฅ Installation

Quick Install (Single Command)

# Download and install k0s
curl -sSLf https://get.k0s.sh | sudo sh

This downloads the k0s binary to /usr/local/bin/k0s


Manual Installation

# Download specific version
VERSION="v1.28.5+k0s.0"
wget https://github.com/k0sproject/k0s/releases/download/${VERSION}/k0s-${VERSION}-amd64

# Make executable
chmod +x k0s-${VERSION}-amd64

# Move to PATH
sudo mv k0s-${VERSION}-amd64 /usr/local/bin/k0s

# Verify installation
k0s version

๐Ÿš€ Single-Node Cluster

Install as Controller+Worker

# Install k0s as a service (controller + worker on same node)
sudo k0s install controller --single

# Start k0s
sudo k0s start

# Check status
sudo k0s status

Output:

Version: v1.28.5+k0s.0
Process ID: 1234
Role: controller+worker
Workloads: true
SingleNode: true

Get kubeconfig

# Export kubeconfig
sudo k0s kubeconfig admin > ~/.kube/k0s-config

# Or set KUBECONFIG environment variable
export KUBECONFIG=~/.kube/k0s-config

# Test access
k0s kubectl get nodes

Output:

NAME   STATUS   ROLES    AGE   VERSION
k0s    Ready    <none>   1m    v1.28.5+k0s.0

Install kubectl (Optional)

k0s includes kubectl, but you can install standalone:

# Download kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

# Install
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

# Verify
kubectl version --client

Use k0s kubectl:

# Alias for convenience
alias kubectl='k0s kubectl'

๐ŸŽฏ First Application

Deploy Nginx

# Create deployment
k0s kubectl create deployment nginx --image=nginx

# Expose as service
k0s kubectl expose deployment nginx --port=80 --type=NodePort

# Check status
k0s kubectl get deployments
k0s kubectl get pods
k0s kubectl get services

Output:

NAME    READY   UP-TO-DATE   AVAILABLE   AGE
nginx   1/1     1            1           30s

NAME          READY   STATUS    RESTARTS   AGE
nginx-abc123  1/1     Running   0          30s

NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
nginx        NodePort    10.96.1.100    <none>        80:30080/TCP   20s

Access Application

# Get node port
PORT=$(k0s kubectl get service nginx -o jsonpath='{.spec.ports[0].nodePort}')

# Test locally
curl http://localhost:$PORT

# Or from external machine
curl http://your-server-ip:$PORT

View Logs

# Get pod name
POD=$(k0s kubectl get pod -l app=nginx -o jsonpath='{.items[0].metadata.name}')

# View logs
k0s kubectl logs $POD

# Follow logs
k0s kubectl logs -f $POD

Scale Application

# Scale to 3 replicas
k0s kubectl scale deployment nginx --replicas=3

# Check pods
k0s kubectl get pods -l app=nginx

Output:

NAME           READY   STATUS    RESTARTS   AGE
nginx-abc123   1/1     Running   0          5m
nginx-def456   1/1     Running   0          10s
nginx-ghi789   1/1     Running   0          10s

๐Ÿ“ Kubernetes Basics (via k0s)

Pods

Smallest deployable unit in Kubernetes

# Create pod from YAML
cat <<EOF | k0s kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
  labels:
    app: nginx
spec:
  containers:
  - name: nginx
    image: nginx:alpine
    ports:
    - containerPort: 80
EOF

# Check pod
k0s kubectl get pod nginx-pod

# Describe pod (detailed info)
k0s kubectl describe pod nginx-pod

# Execute command in pod
k0s kubectl exec -it nginx-pod -- /bin/sh

# Delete pod
k0s kubectl delete pod nginx-pod

Deployments

Manages replica sets and rolling updates

# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: nginx:alpine
        ports:
        - containerPort: 80
# Apply deployment
k0s kubectl apply -f deployment.yaml

# Check rollout status
k0s kubectl rollout status deployment myapp

# Update image (rolling update)
k0s kubectl set image deployment myapp myapp=nginx:latest

# Rollback
k0s kubectl rollout undo deployment myapp

Services

Expose pods to network

# service.yaml
apiVersion: v1
kind: Service
metadata:
  name: myapp-service
spec:
  selector:
    app: myapp
  ports:
  - port: 80
    targetPort: 80
  type: LoadBalancer  # or ClusterIP, NodePort
# Apply service
k0s kubectl apply -f service.yaml

# Get service details
k0s kubectl get service myapp-service

# Get service endpoints
k0s kubectl get endpoints myapp-service

ConfigMaps

Store configuration data

# Create from literal
k0s kubectl create configmap app-config \
  --from-literal=database_url=postgres://db:5432 \
  --from-literal=cache_enabled=true

# Create from file
echo "debug=true" > config.properties
k0s kubectl create configmap app-config --from-file=config.properties

# Use in pod
cat <<EOF | k0s kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: myapp
spec:
  containers:
  - name: app
    image: myapp
    envFrom:
    - configMapRef:
        name: app-config
EOF

Secrets

Store sensitive data (base64 encoded)

# Create secret
k0s kubectl create secret generic db-secret \
  --from-literal=username=admin \
  --from-literal=password=secretpass

# View secret (base64 encoded)
k0s kubectl get secret db-secret -o yaml

# Use in pod
cat <<EOF | k0s kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: myapp
spec:
  containers:
  - name: app
    image: myapp
    env:
    - name: DB_USERNAME
      valueFrom:
        secretKeyRef:
          name: db-secret
          key: username
    - name: DB_PASSWORD
      valueFrom:
        secretKeyRef:
          name: db-secret
          key: password
EOF

๐ŸŒ Namespaces

Create Namespace

# Create namespace
k0s kubectl create namespace development

# List namespaces
k0s kubectl get namespaces

# Deploy to namespace
k0s kubectl create deployment nginx --image=nginx -n development

# Set default namespace
k0s kubectl config set-context --current --namespace=development

# Get resources in namespace
k0s kubectl get all -n development

๐Ÿ” Troubleshooting

Check Cluster Health

# k0s status
sudo k0s status

# Component health
k0s kubectl get componentstatuses

# Node status
k0s kubectl get nodes -o wide

# System pods
k0s kubectl get pods -n kube-system

Common Issues

Issue: Pods stuck in Pending

# Check events
k0s kubectl describe pod <pod-name>

# Common causes:
# - Insufficient resources
# - Image pull errors
# - Node selectors not matching

Fix:

# Check node resources
k0s kubectl top nodes

# Check pod resource requests
k0s kubectl describe pod <pod-name> | grep -A5 "Requests"

Issue: Pod CrashLoopBackOff

# Check logs
k0s kubectl logs <pod-name>

# Check previous container logs
k0s kubectl logs <pod-name> --previous

# Describe pod for events
k0s kubectl describe pod <pod-name>

Issue: Service not accessible

# Check service endpoints
k0s kubectl get endpoints <service-name>

# If no endpoints, check pod labels match service selector
k0s kubectl get pods --show-labels
k0s kubectl get service <service-name> -o yaml | grep selector

# Check pod is running
k0s kubectl get pods -l app=<label>

View k0s Logs

# k0s system logs
sudo journalctl -u k0scontroller -f

# containerd logs
sudo journalctl -u k0sworker -f

# All k0s logs
sudo k0s logs

๐Ÿ› ๏ธ Management Commands

Stop and Start

# Stop k0s
sudo k0s stop

# Start k0s
sudo k0s start

# Restart k0s
sudo k0s stop && sudo k0s start

Backup and Restore

# Backup cluster
sudo k0s backup --save-path /backup/k0s-backup.tar.gz

# Restore cluster
sudo k0s restore /backup/k0s-backup.tar.gz

Reset Cluster

# Stop k0s
sudo k0s stop

# Reset (removes all data)
sudo k0s reset

# Reinstall
sudo k0s install controller --single
sudo k0s start

Uninstall

# Stop k0s
sudo k0s stop

# Reset
sudo k0s reset

# Remove binary
sudo rm /usr/local/bin/k0s

# Remove systemd service
sudo rm /etc/systemd/system/k0scontroller.service
sudo systemctl daemon-reload

๐Ÿ“Š Useful Commands

Quick Reference

# Get everything
k0s kubectl get all

# Get pods with details
k0s kubectl get pods -o wide

# Watch resources
k0s kubectl get pods --watch

# Explain resource
k0s kubectl explain pod
k0s kubectl explain pod.spec

# Resource usage
k0s kubectl top nodes
k0s kubectl top pods

# Shell into pod
k0s kubectl exec -it <pod-name> -- /bin/sh

# Port forward
k0s kubectl port-forward <pod-name> 8080:80

# Copy files
k0s kubectl cp <pod-name>:/path/to/file ./local-file

# Events
k0s kubectl get events --sort-by=.metadata.creationTimestamp

๐ŸŽ“ Next Steps

Practice:

  1. Deploy a multi-container application
  2. Use ConfigMaps and Secrets
  3. Experiment with scaling
  4. Practice troubleshooting

Learn More:


๐Ÿ“š Resources

Official Docs:

Kubernetes:

Community:


๐Ÿ“ Change Log

2026-01-30


Next Article: k0s-installation - Production installation!

Choose Theme

Your selection is saved locally.

Neural Cacophony
Aperture v2
Flux v1
Mosaic Chaos
Nexus v1
Nexus Zest
Prism v2
Synapse