diff --git a/update-kubeadm-cert.sh b/update-kubeadm-cert.sh index 49ee5d5..12b0c29 100755 --- a/update-kubeadm-cert.sh +++ b/update-kubeadm-cert.sh @@ -117,11 +117,21 @@ cert::check_master_certs_expiration() { "${FRONT_PROXY_CLIENT}" ) - kubeconfs=( - "${CONF_CONTROLLER_MANAGER}" - "${CONF_SCHEDULER}" - "${CONF_ADMIN}" - ) + # add support for super_admin.conf, which was added after k8s v1.30. + if [ -f "${CONF_SUPER_ADMIN}.conf" ]; then + kubeconfs=( + "${CONF_CONTROLLER_MANAGER}" + "${CONF_SCHEDULER}" + "${CONF_ADMIN}" + "${CONF_SUPER_ADMIN}" + ) + else + kubeconfs=( + "${CONF_CONTROLLER_MANAGER}" + "${CONF_SCHEDULER}" + "${CONF_ADMIN}" + ) + fi printf "%-50s%-30s\n" "CERTIFICATE" "EXPIRES" @@ -279,8 +289,15 @@ cert::update_master_cert() { log::info "${GREEN}updated ${BLUE}${CERT_APISERVER_KUBELET_CLIENT}.crt${NC}" # generate kubeconf for controller-manager,scheduler and kubelet - # /etc/kubernetes/controller-manager,scheduler,admin,kubelet.conf - for conf in ${CONF_CONTROLLER_MANAGER} ${CONF_SCHEDULER} ${CONF_ADMIN} ${CONF_KUBELET}; do + # /etc/kubernetes/controller-manager,scheduler,admin,kubelet.conf,super_admin(added after k8s v1.30.) + + if [ -f "${CONF_SUPER_ADMIN}.conf" ]; then + conf_list="${CONF_CONTROLLER_MANAGER} ${CONF_SCHEDULER} ${CONF_ADMIN} ${CONF_KUBELET} ${CONF_SUPER_ADMIN}" + else + conf_list="${CONF_CONTROLLER_MANAGER} ${CONF_SCHEDULER} ${CONF_ADMIN} ${CONF_KUBELET}" + fi + + for conf in ${conf_list}; do if [[ ${conf##*/} == "kubelet" ]]; then # https://github.com/kubernetes/kubeadm/issues/1753 set +e @@ -380,6 +397,7 @@ main() { CONF_CONTROLLER_MANAGER=${KUBE_PATH}/controller-manager CONF_SCHEDULER=${KUBE_PATH}/scheduler CONF_ADMIN=${KUBE_PATH}/admin + CONF_SUPER_ADMIN=${KUBE_PATH}/super-admin CONF_KUBELET=${KUBE_PATH}/kubelet # front-proxy FRONT_PROXY_CA=${PKI_PATH}/front-proxy-ca @@ -434,6 +452,7 @@ main() { '\033[32m./update-kubeadm-cert.sh all\033[0m' update all etcd certificates, master certificates and kubeconf /etc/kubernetes ├── admin.conf + ├── super-admin.conf ├── controller-manager.conf ├── scheduler.conf ├── kubelet.conf @@ -450,6 +469,7 @@ main() { '\033[32m./update-kubeadm-cert.sh master\033[0m' update only master certificates and kubeconf /etc/kubernetes ├── admin.conf + ├── super-admin.conf ├── controller-manager.conf ├── scheduler.conf ├── kubelet.conf