You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tilt for Dev: Internal LB for Cluster VNet Communication
163
-
</a> section.
159
+
To use an internal load balancer (ILB) for intra-cluster node-apiserver traffic in your workload cluster, please refer to the
160
+
<a href="./tilt-with-aks-as-mgmt-ilb.md">Tilt with AKS as Management Cluster</a> guide.
164
161
</p>
165
162
</aside>
166
163
@@ -262,6 +259,8 @@ make delete-workload-cluster
262
259
263
260
#### Tilt for dev using internal load balancer (ILB) for intra-cluster node-apiserver traffic
264
261
262
+
263
+
265
264
This flow is for developers who want to leverage the internal load balancer for intra-cluster node-apiserver traffic.
266
265
You can achieve this by setting the `EXP_APISERVER_ILB` environment variable to `true` in your shell (run `export EXP_APISERVER_ILB=true`) and then create the CAPZ management cluster.
# Tilt with AKS as Management Cluster with Internal Load Balancer
2
+
3
+
## Introduction
4
+
This guide is explaining how to set up and use Azure Kubernetes Service (AKS) as a management cluster for Cluster API Provider Azure (CAPZ) development using Tilt and an internal load balancer (ILB).
5
+
6
+
While the default Tilt setup recommends using a KIND cluster as the management cluster for faster development and experimentation, this guide demonstrates using AKS as an alternative management cluster. We also cover additional steps for working with stricter network policies - particularly useful for organizations that need to maintain all cluster communications within their Azure Virtual Network (VNet) infrastructure with enhanced access controls.
7
+
8
+
### Who is this for?
9
+
- Developers who want to use AKS as the management cluster for CAPZ development.
10
+
- Developers working in environments with strict network security requirements.
11
+
- Teams that need to keep all Kubernetes API traffic within Azure VNet
12
+
13
+
14
+
**Note:** This is not a production ready solution and should not be used in a production environment. This is only meant to be used for development/testing purposes.
15
+
16
+
### Prerequisites
17
+
- All [general CAPZ prerequisites](../getting-started.md#prerequisites) should be satisfied
18
+
- Basic understanding of Azure networking concepts.
19
+
- Familiarity with Cluster API and CAPZ.
20
+
- Tilt installed on your development machine.
21
+
-`export REGISTRY=<registry_of_your-choice>` set to the registry of your choice.
22
+
- If `tilt-settings.yaml` file exists in the root of your repo, clear out any values in `kustomize_settings` unless you want to use them instead of the values that will be set by running `make aks-create`.
23
+
24
+
## Using Tilt with AKS as the Management Cluster
25
+
26
+
To use Tilt with AKS as the management cluster, you need to run the following commands:
27
+
-`make clean`
28
+
-`make generate`
29
+
-`make acr-login`
30
+
-`make aks-create`
31
+
-`make tilt-up`
32
+
33
+
Using the tilt UI, click on the flavors you want to deploy and CAPZ will deploy the workload cluster with the selected flavor.
34
+
35
+
## Leveraging internal load balancer
36
+
37
+
By default using Tilt with Cluster API Provider Azure (CAPZ), the management cluster is exposed via a public endpoint. This works well for many development scenarios but presents challenges in environments with strict network security requirements.
38
+
39
+
40
+
### Challenges and Solutions
41
+
42
+
1.**Management to Workload Cluster Connectivity**
43
+
44
+
**Scenario:**
45
+
- Management cluster cannot connect to workload cluster's API server via workload cluster's FQDN.
46
+
47
+
**Solution:**
48
+
- Peer management and workload cluster VNets.
49
+
- Set Workload cluster API server replica count to 3. (Default is 1 when using KIND as the management cluster).
50
+
- This is done by setting `CONTROL_PLANE_MACHINE_COUNT` to 3 in the tilt-settings.yaml file.
51
+
-`make aks-create` will set this value to 3 for you.
52
+
- Create a internal load balancer (ILB) with the workload cluster's apiserver VMs as its backend pool in the workload cluster's VNet.
53
+
- This is achieved by setting `EXP_INTERNAL_LB=true`. `EXP_INTERNAL_LB` is set to `true` by default when running `make tilt-up`.
54
+
- Create private DNS zone with workload cluster's apiserver FQDN as its record to route management cluster calls to workload cluster's API server private IP.
55
+
- As of current release, a private DNS zone is automatically created in the tilt workflow for `apiserver-ilb` and `windows-apiserver-ilb` flavors.
56
+
57
+
2.**Workload Cluster Node Communication**
58
+
59
+
**Scenario:**
60
+
- Workload cluster worker nodes should not be able to communicate with their workload cluster's API server's FQDN.
61
+
62
+
**Solution:**
63
+
- Update `/etc/hosts` on worker nodes via preKubeadmCommands in the `KubeadmConfigTemplate` with `- echo '${AZURE_INTERNAL_LB_PRIVATE_IP} ${CLUSTER_NAME}-${APISERVER_LB_DNS_SUFFIX}.${AZURE_LOCATION}.cloudapp.azure.com' >> /etc/hosts`
64
+
- This essentially creates a static route (using the ILB's private IP) to the workload cluster's API server (FQDN) in the worker nodes.
65
+
- Deploying `apiserver-ilb` or `windows-apiserver-ilb` flavor will deploy worker nodes of the workload cluster with the private IP of the ILB as their default route.
66
+
67
+
3.**Network Security Restrictions**
68
+
69
+
**Scenario:**
70
+
- Critical ports needed for management cluster to communicate with workload cluster.
71
+
- ports:
72
+
-`TCP: 443, 6443`
73
+
-`UDP: 53`
74
+
75
+
**Solution:**
76
+
- Once tilt UI is up and running, click on the `allow required ports on mgmt cluster` task to allow the required ports on the management cluster's API server.
77
+
78
+
4.**Load Balancer Hairpin Routing**
79
+
80
+
**Challenge:**
81
+
- Workload cluster's control plane fails to bootstrap due to internal LB connectivity timeouts.
82
+
- Single control plane node setup causes hairpin routing issues.
83
+
84
+
**Solution:**
85
+
- Use 3 control plane nodes in a stacked etcd setup.
86
+
- Using aks as management cluster sets `CONTROL_PLANE_MACHINE_COUNT` to 3 by default.
87
+
88
+
### Flavors leveraging internal load balancer
89
+
-`cluster-template-apiserver-ilb.yaml`
90
+
-`cluster-template-windows-apiserver-ilb.yaml`
91
+
92
+
#### Tilt Workflow for AKS as Management Cluster with Internal Load Balancer
93
+
94
+
- In tilt-settings.yaml, set subscription_type to "corporate" and remove any other env values unless you want to override env variables created by `make aks-create`. Example:
95
+
```
96
+
.
97
+
.
98
+
kustomize_substitutions:
99
+
"SUBSCRIPTION_TYPE": "corporate"
100
+
.
101
+
```
102
+
-`make clean`
103
+
- This make target does not need to be run every time. Run it to remove bin and kubeconfigs.
104
+
-`make generate`
105
+
- This make target does not need to be run every time. Run it to update your go related targets, manifests, flavors, e2e-templates and addons.
106
+
- Run it periodically upon updating your branch or if you want to make changes in your templates.
107
+
-`make acr-login`
108
+
- Run this make target if you have `REGISTRY` set to an Azure Container Registry.
109
+
-`make aks-create`
110
+
- Run this target to bring up an AKS cluster.
111
+
- Once the AKS cluster is created, you can reuse the cluster as many times as you like. Tilt ensures that the new image gets deployed every time there are changes in the Tiltfile and/or dependent files.
112
+
- Running `make aks-create` cleans up any existing `aks_as_mgmt_settings`.
113
+
-`make tilt-up`
114
+
- Run this target to use underlying cluster being pointed by your `KUBECONFIG`.
115
+
116
+
Once the tilt UI is up and running
117
+
- Click on the `allow required ports on mgmt cluster` task to allow the required ports on the management cluster's API server.
118
+
- Note: This task will wait for the NSG rules to be created and then update them to allow the required ports.
119
+
- This task will take a few minutes to complete.
120
+
- This target can run in parallel and independent of deploying any cluster flavors.
121
+
- Click on the flavors you want to deploy and CAPZ will deploy the workload cluster with the selected flavor.
122
+
- Flavors that leverage internal load balancer are:
0 commit comments