k3s-io / k3s

Lightweight Kubernetes
https://k3s.io
Apache License 2.0
28.09k stars 2.35k forks source link

K3s does not respect `data-dir` set via config file drop-in, or via env var #10589

Closed brandond closed 3 months ago

brandond commented 3 months ago
  1. The multicall wrapper script does not honor config file drop-ins for the --data-dir flag. The flag will be found if set in the CLI args, or in /etc/rancher/k3s/config.yaml, but not if it is set in any file in /etc/rancher/k3s/config.yaml.d (or the equivalent drop-in dir if the --config flag is used to change the path to config.yaml).

  2. The K3S_DATA_DIR env var does not map to the --data-dir CLI flag. It probably should. The multicall wrapper sets the K3S_DATA_DIR env var when it runs wrapped commands, but it appears that this is no longer used for anything - as there are no references to it anywhere else in the code base: https://github.com/k3s-io/k3s/blob/59e07610431588a35aa535de4bf909721fa7111c/cmd/k3s/main.go#L196

To reproduce:

Note that for the case where data-dir is set in /etc/rancher/k3s/config.yaml.d/, the value is PARTIALLY respected. The stage 2 k3s server command honors the setting, but the binaries and packaged manifests are extracted out to the default path by the stage 1 multicall wrapper.

brandond commented 3 months ago

It looks like K3S_DATA_DIR was used by the strongswan ipsec flannel backend to pass through the bin dir to the

This has been gone for quite some time so there is no need for this to be set any longer:

ShylajaDevadiga commented 3 months ago

Closing this issue as validated https://github.com/k3s-io/k3s/issues/10592#issuecomment-2258907482