-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
Problem:
The units/kube-apiserver.service file is missing the --service-cluster-ip-range flag, which causes the Kubernetes API server to use a default service CIDR (10.0.0.0/24) that doesn't match the IP addresses included in the kube-apiserver certificate generated in Step 4.
Symptoms:
When deploying cluster addons like CoreDNS, pods fail to connect to the Kubernetes API with certificate validation errors:
x509: certificate is valid for 127.0.0.1, 10.32.0.1, ... but not 10.0.0.1
Root Cause:
-
In Step 4 (Provisioning a CA and Generating TLS Certificates), the
ca.confconfiguration generates a kube-apiserver certificate with10.32.0.1as a Subject Alternative Name (SAN). This assumes a service CIDR of10.32.0.0/16. -
In Step 8 (Bootstrapping the Kubernetes Control Plane), the
units/kube-apiserver.servicefile does not specify--service-cluster-ip-range, causing kube-apiserver to use the default service CIDR of10.0.0.0/24. -
The
kubernetes.defaultservice gets assigned10.0.0.1instead of10.32.0.1 -
When CoreDNS or other pods try to connect to
https://10.0.0.1:443, the TLS handshake fails because10.0.0.1is not in the certificate's SAN list.
Files Affected:
units/kube-apiserver.service- Missing--service-cluster-ip-range=10.32.0.0/16
Expected Behavior:
The kube-apiserver should be configured with --service-cluster-ip-range=10.32.0.0/16 to match the IP addresses in the generated certificate.
Proposed Fix:
Add the following line to units/kube-apiserver.service after the --service-account-issuer flag:
--service-cluster-ip-range=10.32.0.0/16 \