Skip to content

k3s

k3s installs k3s on VMs/Bare-Metal hosts. When a plugin like hcloud_vms is used, a file called inventory.yml will be available for k3s to determine the connection data for the machines to provision Kubernetes to. Alternatively, a custom inventory can be provided.

Directories used

  • /usr/local/bin/ (k3s binary)
  • /etc/systemd/system (k3s systemd units)
  • /var/lib/kubelet (kubelet data)
  • /var/log/ (logs)
  • /var/lib/rancher/k3s (k3s data, containers, images)

Configuration

# defaults
commands:
  install:
    script:
      - ansible-playbook k8s_k3s.yml
  uninstall:
    script:
      - ansible-playbook k8s_k3s.yml
version: v1.21.1+k3s1
config:
  agent:
    args: ""
  api:
    endpoint: ""
    token: ""
  server:
    args:
      --kube-scheduler-arg 'bind-address=0.0.0.0' --kube-scheduler-arg 'address=0.0.0.0'
      --kube-proxy-arg 'metrics-bind-address=0.0.0.0' --kube-controller-manager-arg
      'bind-address=0.0.0.0' --kube-controller-manager-arg 'address=0.0.0.0' --kube-controller-manager-arg
      'allocate-node-cidrs' --etcd-expose-metrics --disable traefik,local-storage
      --disable-cloud-controller --kubelet-arg=image-gc-high-threshold=85 --kubelet-arg=image-gc-low-threshold=80 --kubelet-arg container-log-max-files=4 --kubelet-arg container-log-max-size=50Mi
  systemd_dir: /etc/systemd/system

Note

To use cilium instead of flannel, set enabled enabled to true in cilium's config in the Stackfile


Last update: June 3, 2022