Skip to content

Commit

Permalink
regenerate kubelet kubeconfig with proper node interface ip (#176)
Browse files Browse the repository at this point in the history
Signed-off-by: Piyush Kumar <[email protected]>
  • Loading branch information
kpiyush17 authored Feb 21, 2025
1 parent eb67502 commit 6da894c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/kube-reconfigure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ regenerate_kubelet_envs() {
if [ "$node_role" != "worker" ];
then
mv /etc/kubernetes/kubelet.conf /etc/kubernetes/kubelet.conf.bak
kubeadm init phase kubeconfig kubelet
NODE_IP=$(grep "node-ip" "$root_path"/opt/kubeadm/kubeadm.yaml | awk '{print $2}')
if [[ -n "$NODE_IP" ]]; then
kubeadm init phase kubeconfig kubelet --apiserver-advertise-address "$NODE_IP"
else
kubeadm init phase kubeconfig kubelet
fi
fi

systemctl restart kubelet
Expand Down

0 comments on commit 6da894c

Please sign in to comment.