@@ -480,7 +480,6 @@ function generate_certs {
480
480
kube::util::create_serving_certkey " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " " server-ca" kube-apiserver kubernetes.default kubernetes.default.svc " localhost" ${API_HOST_IP} ${API_HOST} ${FIRST_SERVICE_CLUSTER_IP}
481
481
482
482
# Create client certs signed with client-ca, given id, given CN and a number of groups
483
- kube::util::create_client_certkey " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " ' client-ca' kubelet system:node:${HOSTNAME_OVERRIDE} system:nodes
484
483
kube::util::create_client_certkey " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " ' client-ca' kube-proxy system:kube-proxy system:nodes
485
484
kube::util::create_client_certkey " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " ' client-ca' controller system:kube-controller-manager
486
485
kube::util::create_client_certkey " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " ' client-ca' scheduler system:kube-scheduler
@@ -495,6 +494,11 @@ function generate_certs {
495
494
kube::util::write_client_kubeconfig " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " " ${ROOT_CA_FILE} " " ${API_HOST} " " ${API_SECURE_PORT} " kube-aggregator
496
495
}
497
496
497
+ function generate_kubelet_certs {
498
+ kube::util::create_client_certkey " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " ' client-ca' kubelet system:node:${HOSTNAME_OVERRIDE} system:nodes
499
+ kube::util::write_client_kubeconfig " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " " ${ROOT_CA_FILE} " " ${API_HOST} " " ${API_SECURE_PORT} " kubelet
500
+ }
501
+
498
502
function start_apiserver {
499
503
security_admission=" "
500
504
if [[ -n " ${DENY_SECURITY_CONTEXT_ADMISSION} " ]]; then
614
618
# Create kubeconfigs for all components, using client certs
615
619
kube::util::write_client_kubeconfig " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " " ${ROOT_CA_FILE} " " ${API_HOST} " " ${API_SECURE_PORT} " admin
616
620
${CONTROLPLANE_SUDO} chown " ${USER} " " ${CERT_DIR} /client-admin.key" # make readable for kubectl
617
- kube::util::write_client_kubeconfig " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " " ${ROOT_CA_FILE} " " ${API_HOST} " " ${API_SECURE_PORT} " kubelet
618
621
kube::util::write_client_kubeconfig " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " " ${ROOT_CA_FILE} " " ${API_HOST} " " ${API_SECURE_PORT} " kube-proxy
619
622
kube::util::write_client_kubeconfig " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " " ${ROOT_CA_FILE} " " ${API_HOST} " " ${API_SECURE_PORT} " controller
620
623
kube::util::write_client_kubeconfig " ${CONTROLPLANE_SUDO} " " ${CERT_DIR} " " ${ROOT_CA_FILE} " " ${API_HOST} " " ${API_SECURE_PORT} " scheduler
@@ -797,6 +800,10 @@ function start_kubelet {
797
800
${KUBELET_FLAGS}
798
801
)
799
802
803
+ if [[ " ${REUSE_CERTS} " != true ]]; then
804
+ generate_kubelet_certs
805
+ fi
806
+
800
807
if [[ -z " ${DOCKERIZE_KUBELET} " ]]; then
801
808
sudo -E " ${GO_OUT} /hyperkube" kubelet " ${all_kubelet_flags[@]} " > " ${KUBELET_LOG} " 2>&1 &
802
809
KUBELET_PID=$!
0 commit comments