--- title: K3s Installation Guide description: A comprehensive guide to installing and configuring K3s for your home lab pubDate: 2025-04-19 heroImage: /blog/images/posts/k3installation.png category: kubernetes tags: - kubernetes - k3s - homelab - tutorial readTime: 8 min read --- # K3s Installation Guide K3s is a lightweight Kubernetes distribution designed for resource-constrained environments, perfect for home labs and edge computing. This guide will walk you through the installation process from start to finish. ## Prerequisites - A machine running Linux (Ubuntu 20.04+ recommended) - Minimum 1GB RAM (2GB+ recommended for multi-workload clusters) - 20GB+ of disk space - Root access or sudo privileges ## Basic Installation The simplest way to install K3s is using the installation script: ```bash curl -sfL https://get.k3s.io | sh - ``` This will install K3s as a server and start the service. To verify it's running: ```bash sudo k3s kubectl get node ``` ## Advanced Installation Options ### Master Node with Custom Options For more control, you can use environment variables: ```bash curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable=traefik" sh - ``` ### Adding Worker Nodes 1. On your master node, get the node token: ```bash sudo cat /var/lib/rancher/k3s/server/node-token ``` 2. On each worker node, run: ```bash curl -sfL https://get.k3s.io | K3S_URL=https://:6443 K3S_TOKEN= sh - ``` ## Accessing the Cluster After installation, the kubeconfig file is written to `/etc/rancher/k3s/k3s.yaml`. To use kubectl externally: 1. Copy this file to your local machine 2. Set the KUBECONFIG environment variable: ```bash export KUBECONFIG=/path/to/k3s.yaml ``` ## Uninstalling K3s If you need to uninstall: - On server nodes: `/usr/local/bin/k3s-uninstall.sh` - On agent nodes: `/usr/local/bin/k3s-agent-uninstall.sh` ## Next Steps Now that you have K3s running, you might want to: - Deploy your first application - Set up persistent storage - Configure ingress for external access Stay tuned for more guides on these topics!