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

New k3s server flag: --write-kubeconfig-own or --write-kubeconfig-group #9209

Closed
kittydoor opened this issue Jan 10, 2024 · 6 comments
Closed
Assignees
Labels
kind/enhancement An improvement to existing functionality
Milestone

Comments

@kittydoor
Copy link
Contributor

Per #389 the default mode for kubeconfig was changed to 600 with ability to override this to 644 (or any other) via a config flag. This is awesome! However, I would like to go with 640 so that I can make it only accessible to a certain group as opposed to world.

It would be great if a flag such as --write-kubeconfig-own <user>:<group> or --write-kubeconfig-group <group> existed so that I can define a group myself, and used together with --write-kubeconfig-mode the file is written as 640 root:.

At the moment, this is a step I take manually after installation. I think it would be more helpful to be able to add this into the configuration file.

@brandond
Copy link
Member

I think --write-kubeconfig-group would be reasonable.

@VestigeJ
Copy link

VestigeJ commented Jun 4, 2024

validated with commit_id on v1.30 branch

$ echo $COMMIT

79ba10f5ec88a2458b44f67d009b4ee071918e4d

$ sudo INSTALL_K3S_COMMIT=$COMMIT INSTALL_K3S_EXEC="server --write-kubeconfig-group=testingNewFeature" ./install-k3s.sh

[INFO]  Using commit 79ba10f5ec88a2458b44f67d009b4ee071918e4d as release
[INFO]  Downloading hash https://k3s-ci-builds.s3.amazonaws.com/k3s-79ba10f5ec88a2458b44f67d009b4ee071918e4d.sha256sum
[INFO]  Downloading binary https://k3s-ci-builds.s3.amazonaws.com/k3s-79ba10f5ec88a2458b44f67d009b4ee071918e4d
[INFO]  Verifying binary download
[INFO]  Installing k3s to /usr/local/bin/k3s
[INFO]  Skipping installation of SELinux RPM
[INFO]  Creating /usr/local/bin/kubectl symlink to k3s
[INFO]  Creating /usr/local/bin/crictl symlink to k3s
[INFO]  Creating /usr/local/bin/ctr symlink to k3s
[INFO]  Creating killall script /usr/local/bin/k3s-killall.sh
[INFO]  Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
[INFO]  systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO]  systemd: Starting k3s

$ ls -lahr /etc/rancher/k3s/

total 8.0K
-rw-r--r-- 1 root testingNewFeature 2.9K Jun  4 00:15 k3s.yaml
-rw-r--r-- 1 root root               223 Jun  4 00:15 config.yaml
drwxr-xr-x 4 root root                29 Jun  4 00:15 ..
drwxr-xr-x 2 root root                41 Jun  4 00:15 .

@VestigeJ VestigeJ assigned VestigeJ and unassigned mdrahman-suse Jun 4, 2024
@VestigeJ VestigeJ closed this as completed Jun 4, 2024
@github-project-automation github-project-automation bot moved this from To Test to Done Issue in K3s Development Jun 4, 2024
@davidshen84
Copy link

Hi @VestigeJ ,

Is this feature officially released? I could not find a reference on https://docs.k3s.io/cli/server, but I can see it on my machine with k3s server -h. My k3s version is v1.30.5+k3s1 (9b58670)

@brandond
Copy link
Member

Yep. Docs frequently lag behind features. A docs PR would be welcomed!

@davidshen84
Copy link

davidshen84 commented Oct 27, 2024 via email

@kittydoor
Copy link
Contributor Author

kittydoor commented Oct 27, 2024

Thank you for pitching in on this! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement An improvement to existing functionality
Projects
Archived in project
Development

No branches or pull requests

6 participants