Skip to content

Commit f97bb17

Browse files
committed
Add pre-kubeadm join commands to worker nodes
- Also pre-create a DNS Name for the frontend LB's IP that get assigned to the controlplane VM.
1 parent 9ba44ee commit f97bb17

15 files changed

+140
-11
lines changed

templates/cluster-template-azure-bastion.yaml

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/cluster-template-azure-cni-v1.yaml

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/cluster-template-edgezone.yaml

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/cluster-template-ephemeral.yaml

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/cluster-template-windows.yaml

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/cluster-template.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ spec:
2929
name: ${CLUSTER_IDENTITY_NAME}
3030
location: ${AZURE_LOCATION}
3131
networkSpec:
32+
apiServerLB:
33+
frontendIPs:
34+
- name: ${CLUSTER_NAME}-api-lb
35+
publicIP:
36+
dnsName: ${CLUSTER_NAME}.${AZURE_LOCATION}.cloudapp.azure.com
37+
name: ${CLUSTER_NAME}-api-lb
3238
subnets:
3339
- name: control-plane-subnet
3440
role: control-plane
@@ -189,7 +195,9 @@ spec:
189195
kubeletExtraArgs:
190196
cloud-provider: external
191197
name: '{{ ds.meta_data["local_hostname"] }}'
192-
preKubeadmCommands: []
198+
preKubeadmCommands:
199+
- echo '10.0.0.4 ${CLUSTER_NAME}.${AZURE_LOCATION}.cloudapp.azure.com' >>
200+
/etc/hosts
193201
---
194202
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
195203
kind: AzureClusterIdentity

templates/flavors/default/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ resources:
55
- ../base
66
- machine-deployment.yaml
77
- ../../azure-cluster-identity
8+
89
patches:
910
- path: ../../azure-cluster-identity/azurecluster-identity-ref.yaml
11+
- path: patches/control-plane.yaml
12+
- path: patches/kubeadm-config-template.yaml
1013

1114
sortOptions:
1215
order: fifo
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
2+
kind: AzureCluster
3+
metadata:
4+
name: ${CLUSTER_NAME}
5+
spec:
6+
networkSpec:
7+
apiServerLB:
8+
# Hack: We pre-create this public IP and the DNS name to use it in the
9+
# worker node's /etc/hosts. This resolves the routing issue due to newly
10+
# implemented security rules in Azure.
11+
frontendIPs:
12+
- name: ${CLUSTER_NAME}-api-lb
13+
publicIP:
14+
name: ${CLUSTER_NAME}-api-lb
15+
dnsName: ${CLUSTER_NAME}.${AZURE_LOCATION}.cloudapp.azure.com
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
2+
kind: KubeadmConfigTemplate
3+
metadata:
4+
name: "${CLUSTER_NAME}-md-0"
5+
spec:
6+
template:
7+
spec:
8+
# Hack: /etc/hosts file is updated with a pre-created DNS name of the API server
9+
# so that worker nodes can access the API server using the internal IP.
10+
# 10.0.0.4 is the default IP that gets assigned to a single control plane
11+
# cluster scenario.
12+
# TODO: Replace 10.0.0.4 with an internal LB that has backend pools pointed to the control plane nodes.
13+
preKubeadmCommands:
14+
- echo '10.0.0.4 ${CLUSTER_NAME}.${AZURE_LOCATION}.cloudapp.azure.com' >> /etc/hosts

templates/flavors/windows/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ resources:
77

88
patches:
99
- path: ../base-windows-containerd/cluster.yaml
10+
- path: patches/kubeadm-config-template.yaml
1011

1112
sortOptions:
1213
order: fifo

0 commit comments

Comments
 (0)