mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-26 15:36:11 -03:30
This commit uses a kubeadm join config to pull down cert for etcd in workers nodes (which is needed in some circumstances, for instance with calico or cilium). The previous way didn't allow us to pass certain parameters which was typically given in the config in other kubeadm invokations in Kubespray. This made kubeadm produced some errors for some edge cases. For example, in our deployment we don't have a default route and even though it's only to download the certificates, kubeadm produce an error `unable to select an IP from default routes` (these command are kubeadm controlplane command, so kubeadm does some additional checks). This is fixed by specifying `advertiseAddress` within the kubeadm config. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
40 lines
1.2 KiB
Django/Jinja
40 lines
1.2 KiB
Django/Jinja
---
|
|
apiVersion: kubeadm.k8s.io/v1beta3
|
|
kind: JoinConfiguration
|
|
discovery:
|
|
bootstrapToken:
|
|
{% if kubeadm_config_api_fqdn is defined %}
|
|
apiServerEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
|
|
{% else %}
|
|
apiServerEndpoint: {{ kubeadm_discovery_address }}
|
|
{% endif %}
|
|
token: {{ kubeadm_token }}
|
|
{% if kubeadm_ca_hash.stdout is defined %}
|
|
caCertHashes:
|
|
- sha256:{{ kubeadm_ca_hash.stdout }}
|
|
{% else %}
|
|
unsafeSkipCAVerification: true
|
|
{% endif %}
|
|
timeout: {{ discovery_timeout }}
|
|
tlsBootstrapToken: {{ kubeadm_token }}
|
|
caCertPath: {{ kube_cert_dir }}/ca.crt
|
|
{% if kubeadm_cert_controlplane is defined and kubeadm_cert_controlplane %}
|
|
controlPlane:
|
|
localAPIEndpoint:
|
|
advertiseAddress: {{ kube_apiserver_address }}
|
|
bindPort: {{ kube_apiserver_port }}
|
|
certificateKey: {{ kubeadm_certificate_key }}
|
|
{% endif %}
|
|
nodeRegistration:
|
|
name: '{{ kube_override_hostname }}'
|
|
criSocket: {{ cri_socket }}
|
|
{% if 'calico_rr' in group_names and 'kube_node' not in group_names %}
|
|
taints:
|
|
- effect: NoSchedule
|
|
key: node-role.kubernetes.io/calico-rr
|
|
{% endif %}
|
|
{% if kubeadm_patches is defined and kubeadm_patches.enabled %}
|
|
patches:
|
|
directory: {{ kubeadm_patches.dest_dir }}
|
|
{% endif %}
|