7

Referencing another answer here, they suggest setting

evictionHard:
  imagefs.available: 1%
  memory.available: 100Mi
  nodefs.available: 1%
  nodefs.inodesFree: 1%

In the file /var/lib/kubelet/config.yaml. However, I do not see that file in my k3s distribution of kubernetes. Where is this file located with k3s?

Evan Carroll
  • 2,921
  • 6
  • 37
  • 85

1 Answers1

7

/etc/rancher/k3s/config.yaml

Note, /etc/rancher/k3s/config.yaml not /etc/rancher/k3s/k3s.yaml! You may have to create the file if it doesn't exist.

K3s doesn't have a dedicated kubelet service. It's integrated into k3s. So it's configured only with the --kubelet-arg flag to k3s. But you can add Kubelet config directives to your config.yaml (/etc/rancher/k3s/config.yaml),

kubelet-arg:
  - "kube-reserved=cpu=500m,memory=1Gi,ephemeral-storage=2Gi"
  - "system-reserved=cpu=500m, memory=1Gi,ephemeral-storage=2Gi"
  - "eviction-hard=memory.available<500Mi,nodefs.available<10%"

Which would look like,

kubelet-arg:
  - "eviction-hard=imagefs.available<case>,memory.available<case>,nodefs.available<case>,nodefs.inodesFree<case>"

You can find more information at,

Evan Carroll
  • 2,921
  • 6
  • 37
  • 85