Closed brandond closed 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:
The embedded swanctl and charon binaries have been removed. If you are using the ipsec flannel backend, please ensure that the strongswan swanctl and charon packages are installed on your node before upgrading k3s.
Closing this issue as validated https://github.com/k3s-io/k3s/issues/10592#issuecomment-2258907482
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).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:
mkdir -p /etc/rancher/k3s; echo "data-dir: /k8s" >> /etc/rancher/k3s/config.yaml; curl -sL get.k3s.io | sh -s - server
curl -sL get.k3s.io | sh -s - server --data-dir=/k8s
mkdir -p /etc/rancher/k3s/config.yaml.d; echo "data-dir: /k8s" >> /etc/rancher/k3s/config.yaml.d/99-data-dir.yaml; curl -sL get.k3s.io | sh -s - server
curl -sL get.k3s.io | K3S_DATA_DIR=/k8s sh -s - server
Note that for the case where
data-dir
is set in /etc/rancher/k3s/config.yaml.d/, the value is PARTIALLY respected. The stage 2k3s server
command honors the setting, but the binaries and packaged manifests are extracted out to the default path by the stage 1 multicall wrapper.