[Master, API LB] VIP hostname does not get propagated to kubeconfig
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Keepalived Charm |
Triaged
|
High
|
Unassigned | ||
Kubernetes API Load Balancer |
Incomplete
|
Undecided
|
Unassigned | ||
Kubernetes Control Plane Charm |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
Looking into how kubernetes cluster VIP / hostname gets propagated over from keepalived down to kubernetes-master, we can see:
kubeapi-
charm: cs:~containers/
expose: true
options:
extra_sans: *kubeapi-lb-url
keepalived:
charm: cs:~containers/
options:
virtual_ip: *kubeapi-lb-vip
vip_hostname: *kubeapi-lb-url
port: 443
kubernetes-
charm: cs:~containers/
num_units: 2
options:
extra_sans: *kubeapi-lb-url
In that configuration, as described on: https:/
Therefore, kubeconfig will have:
apiVersion: v1
clusters:
- cluster:
certificate
server: https://<IP>:443
. . . .
Looking into how kubernetes-master builds up kubeconfig file: https:/
We can see that actually only IPs are passed around to build_kubeconfig, which creates the file itself.
The issue is that, on configuration described at https:/
$ kubectl get nodes
Unable to connect to the server: x509: certificate is valid for <LIST OF IPS, BUT NO VIP>
That happens because our kubeconfig reaches out kube-apiserver using the VIP on its http request, but extra_sans was configured only for hostname.
I believe the most appropriate way is to have a vip_hostname option on both kubernetes-master & kube_api_
tags: | added: cpe-onsite |
Changed in charm-keepalived: | |
importance: | Critical → High |
If I set extra_sans on both kubernetes-master & api loadbalancer to have:
extra_sans: <VIP> <HOSTNAME>
Then it works.
I believe an alternative is to fix keepalived README to advise to include both on extra_sans parameter.
For me, this is a work-around. I still think we should ditch VIP if we have a hostname configured for it. That will spare deployments where we have, for example, OpenStack provider and the VIP changes every time since ports get created and destroyed on-demand.