No description
- HCL 92%
- Python 7%
- Shell 1%
| tofu | ||
| .gitignore | ||
| .gitmodules | ||
| README.md | ||
| renovate.json | ||
Prerequisites
- A Kubernetes (k8s) distribution running, such as microk8s, k3s, minikube, etc.
kubectlhelmk9s(Optional, but recommended) for a nicer experience viewing and managing the cluster.tofufor IaC.
K3s-specific setup
Install k3s with:
curl -sfL https://get.k3s.io | sh -
or connect to a cluster with:
curl -sfL https://get.k3s.io | K3S_URL=https://myserver:6443 K3S_TOKEN=mynodetoken sh -
You can get the token from the cluster host's /var/lib/rancher/k3s/server/node-token file.
Either way, k3s should be running now if everything went well. You can always check its status, enable/disable, start/stop etc with systemctl if you're on Debian or another supporting system.
Copying the config file
K3s creates a config file which is root-only by default. To run k3s, kubectl, and other related commands as non-root, you need to copy this file to somewhere accessible by your user, update its ownership, and set the KUBECONFIG environment variable for persistence.
mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $(whoami) ~/.kube/config
sudo chgrp $(whoami) ~/.kube/config
echo -e "\nexport KUBECONFIG=~/.kube/config" >> ~/.bashrc
source ~/.bashrc