chore(k3s): expand notes and snippets

This commit is contained in:
Michele Cereda
2024-09-14 23:12:08 +02:00
parent 05283b54e7
commit 855aa588ba
4 changed files with 132 additions and 18 deletions

23
snippets/k3s.bash Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# https://k3s.io/
curl -sfL 'https://get.k3s.io' | sh -
curl 'https://github.com/k3s-io/k3s/releases/download/v1.19.7%2Bk3s1/k3s' \
--location --remote-name
# Allow the 'wheel' group to manage the cluster.
sudo chown 'root:wheel' '/etc/rancher/k3s/k3s.yaml'
sudo chmod 'g+r' '/etc/rancher/k3s/k3s.yaml'
# Use tools as a normal user.
ln -s '/etc/rancher/k3s/k3s.yaml' "${HOME}/.kube/config"
sudo k3s server &
# Kubeconfig is written to /etc/rancher/k3s/k3s.yaml
sudo k3s kubectl get node
# On a different node run the below.
# NODE_TOKEN comes from /var/lib/rancher/k3s/server/node-token on your server
sudo k3s agent --server 'https://myserver:6443' --token "${NODE_TOKEN}"
curl -sfL 'https://get.k3s.io' | K3S_URL='https://server:6443' K3S_TOKEN='node-token' sh -