Setup lightweight Kubernetes with K3s
K3s is a lightweight Kubernetes distribution, which looks like easy to install for devops, but not for dummies. This article gives answers for questions: How to solve install error? How to configure ingress? How to use dashboards? How to force Docker? How to use already installed kubectl?
K3s uses a built-in containerd as the container runtime, by default. This default setup has more advantages:
- Docker is not needed.
- If Docker is installed, the K3s containers and Docker containers are running in separated environment and cannot influence each other
Below description forces to use Docker to give opportunity for Docker experts to see what K3s makes under the hood. Of course, below example works without Docker, too (noticed at right place).
The default K3s ingress controller is Traefik, it’s not changed.
Used versions:
- K3s: v1.19.5+k3s2, see built-in versions at https://github.com/k3s-io/k3s/releases/tag/v1.19.5%2Bk3s2
- Kubernetes Dashboard: v2.1.0
- Nginx docker image: latest
Tested on:
- Ubuntu 16.04, bare metal (Intel Celeron N2830, 4 GB RAM)
- Ubuntu 18.04, VM (12 GB RAM), running in Windows 10 Hyper-V