mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #65389 from Random-Liu/add-crictl-into-sudoer-path
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add /home/kubernetes/bin into sudoers path, so that `sudo crictl` works. Add `/home/kubernetes/bin` to sudoers path, so that user can call `sudo crictl` directly. Without this fix, user has to either use the full path `sudo /home/kubernetes/bin/crictl` or switch to root, which is not a good user experience. /cc @yujuhong @feiskyer @filbranden @kubernetes/sig-node-pr-reviews @kubernetes/sig-gcp-pr-reviews **Release note**: ```release-note User can now use `sudo crictl` on GCE cluster. ```
This commit is contained in:
commit
3079c1df2f
@ -2578,6 +2578,16 @@ EOF
|
|||||||
function override-kubectl {
|
function override-kubectl {
|
||||||
echo "overriding kubectl"
|
echo "overriding kubectl"
|
||||||
echo "export PATH=${KUBE_HOME}/bin:\$PATH" > /etc/profile.d/kube_env.sh
|
echo "export PATH=${KUBE_HOME}/bin:\$PATH" > /etc/profile.d/kube_env.sh
|
||||||
|
# Add ${KUBE_HOME}/bin into sudoer secure path.
|
||||||
|
local sudo_path
|
||||||
|
sudo_path=$(sudo env | grep "^PATH=")
|
||||||
|
if [[ -n "${sudo_path}" ]]; then
|
||||||
|
sudo_path=${sudo_path#PATH=}
|
||||||
|
(
|
||||||
|
umask 027
|
||||||
|
echo "Defaults secure_path=\"${KUBE_HOME}/bin:${sudo_path}\"" > /etc/sudoers.d/kube_secure_path
|
||||||
|
)
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function override-pv-recycler {
|
function override-pv-recycler {
|
||||||
|
Loading…
Reference in New Issue
Block a user