From 2af997470fa91438aab747a8dbd613d5bde679aa Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Fri, 22 Jun 2018 14:07:00 -0700 Subject: [PATCH] Add /home/kubernetes/bin into sudoers path, so that `sudo crictl` works. --- cluster/gce/gci/configure-helper.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 0464b89d58f..c81f5cea514 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -2578,6 +2578,16 @@ EOF function override-kubectl { echo "overriding kubectl" 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 {