From 7ce2ac575a9d198416bdc53ad1c2da0284c72a03 Mon Sep 17 00:00:00 2001 From: topahadzi Date: Fri, 27 Oct 2023 17:43:56 +0700 Subject: [PATCH] update config context --- test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index f33c217..06a4aee 100755 --- a/test.sh +++ b/test.sh @@ -13,7 +13,9 @@ if [ -z "$NODE_NAMES" ]; then fi for NODE_NAME in $NODE_NAMES; do - kubectl config set-context default --cluster kubernetes --user=service-account + kubectl config set-cluster kubernetes --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --server=https://kubernetes.default.svc + kubectl config set-credentials sa --token $(cat /var/run/secrets/kubernetes.io/serviceaccount/token) + kubectl config set-context default --cluster kubernetes --user=sa kubectl config use-context default echo "Running command on node: $NODE_NAME" kubectl node_shell $NODE_NAME -- reboot