K3s - Lightweight Kubernetes
k8s is 10-char-word but k3s is 5-char-word which is half.
See https://docs.k3s.io/quick-start#install-script
curl -sfL https://get.k3s.io | sh -
Initiall it's only allowed to root account
So kubectl from user account will fail
$ k3s kubectl version
WARN[0000] Unable to read /etc/rancher/k3s/k3s.yaml, please start server with --write-kubeconfig-mode to modify kube config permissions
error: error loading config file "/etc/rancher/k3s/k3s.yaml" : open /etc/rancher/k3s/k3s.yaml: permission denied
To use kubectl from your account, see this
put following in either .profile, .zshrc, .bashrc
export KUBECONFIG=~/.kube/config
to make it applied, do either
- source ~/.zshrc
- sudo su - $USER
- reconnect ssh
mkdir ~/.kube 2> /dev/null
sudo chown $USER:$USER ~/.kube
sudo k3s kubectl config view --raw | tee ~/.kube/config
chmod 600 "$KUBECONFIG"