Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
brandond opened this issue Jul 29, 2024 · 2 comments
Closed
Assignees

Comments

@brandond
Copy link
Member

brandond commented Jul 29, 2024

  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:

    if err := os.Setenv(version.ProgramUpper+"_DATA_DIR", dir); err != nil {

To reproduce:

  • Install k3s with mkdir -p /etc/rancher/k3s; echo "data-dir: /k8s" >> /etc/rancher/k3s/config.yaml; curl -sL get.k3s.io | sh -s - server
    • note that data-dir is used
  • Install k3s with curl -sL get.k3s.io | sh -s - server --data-dir=/k8s
    • note that data-dir is used
  • Install k3s with 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
    • note that data-dir is NOT used
  • Install k3s with curl -sL get.k3s.io | K3S_DATA_DIR=/k8s sh -s - server
    • note that data-dir is NOT used

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 brandond moved this from New to Next Up in K3s Development Jul 29, 2024
@brandond brandond moved this from Next Up to Working in K3s Development Jul 29, 2024
@brandond brandond self-assigned this Jul 29, 2024
@brandond
Copy link
Member Author

brandond commented Jul 29, 2024

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
Copy link
Contributor

Closing this issue as validated
#10592 (comment)

@github-project-automation github-project-automation bot moved this from To Test to Done Issue in K3s Development Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants