Skip to content

Commit 85d64b9

Browse files
authored
Merge pull request #5522 from alimaazamat/update-tilt-aks-docs
Refactored Tilt with AKS docs
2 parents 398a03d + c44cafe commit 85d64b9

File tree

1 file changed

+59
-55
lines changed

1 file changed

+59
-55
lines changed

docs/book/src/developers/tilt-with-aks-as-mgmt-ilb.md

+59-55
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,76 @@ While the default Tilt setup recommends using a KIND cluster as the management c
1010
- Developers working in environments with strict network security requirements.
1111
- Teams that need to keep all Kubernetes API traffic within Azure VNet
1212

13-
1413
**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.
1514

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.
15+
## Prerequisites
16+
17+
### Requirements
18+
<!-- markdown-link-check-disable-next-line -->
19+
- A [Microsoft Azure account](https://azure.microsoft.com/)
20+
- Note: If using a new subscription, make sure to [register](https://learn.microsoft.com/azure/azure-resource-manager/management/resource-providers-and-types) the following resource providers:
21+
- `Microsoft.Compute`
22+
- `Microsoft.Network`
23+
- `Microsoft.ContainerService`
24+
- `Microsoft.ManagedIdentity`
25+
- `Microsoft.Authorization`
26+
- `Microsoft.ResourceHealth` (if the `EXP_AKS_RESOURCE_HEALTH` feature flag is enabled)
27+
- Install the [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest)
28+
- A [supported version](https://github.com/kubernetes-sigs/cluster-api-provider-azure#compatibility) of [clusterctl](https://cluster-api.sigs.k8s.io/user/quick-start#install-clusterctl)
29+
- Basic understanding of Azure networking concepts, Cluster API, and CAPZ.
30+
- `go`, `wget`, and `tilt` installed on your development machine.
2231
- 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`.
2332

24-
## Using Tilt with AKS as the Management Cluster
33+
### Managed Identity & Registry Setup
34+
1. Have a managed identity created from Azure Portal.
35+
2. Add the following lines to your shell config such as `~/.bashrc` or `~/.zshrc`
36+
```shell
37+
export USER_IDENTITY="<user-assigned-managed-identity-name>"
38+
export AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY="<user-assigned-managed-identity-client-id>"
39+
export AZURE_CLIENT_ID="${AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY}"
40+
export AZURE_OBJECT_ID_USER_ASSIGNED_IDENTITY="<user-assigned-managed-identity--object-id>"
41+
export AZURE_LOCATION="<azure-location-having-quota-for-B2s-and-D4s_v3-SKU>"
42+
export REGISTRY=<your-container-registry>
43+
```
44+
3. Be sure to reload with `source ~/.bashrc` or `source ~/.zshrc` and then verify the correct env vars values return with `echo $AZURE_CLIENT_ID` and `echo $REGISTRY`.
2545

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`
46+
## Steps to Use Tilt with AKS as the Management Cluster
3247

33-
Using the tilt UI, click on the flavors you want to deploy and CAPZ will deploy the workload cluster with the selected flavor.
48+
1. 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:
49+
```
50+
.
51+
.
52+
.
53+
kustomize_substitutions:
54+
SUBSCRIPTION_TYPE: "corporate"
55+
.
56+
```
57+
2. `make clean`
58+
- This make target does not need to be run every time. Run it to remove bin and kubeconfigs.
59+
3. `make generate`
60+
- 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.
61+
- Run it periodically upon updating your branch or if you want to make changes in your templates.
62+
4. `make acr-login`
63+
- Run this make target only if you have `REGISTRY` set to an Azure Container Registry. If you used DockerHub like we recommend, you can skip this step.
64+
5. `make aks-create`
65+
- Run this target to bring up an AKS cluster.
66+
- 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.
67+
- Running `make aks-create` cleans up any existing variables from `aks_as_mgmt_settings` from the `tilt-settings.yaml`.
68+
6. `make tilt-up`
69+
- Run this target to use underlying cluster being pointed by your `KUBECONFIG`.
70+
71+
7. Once the tilt UI is up and running click on the `allow required ports on mgmt cluster` task (checkmark the box and reload) to allow the required ports on the management cluster's API server.
72+
- Note: This task will wait for the NSG rules to be created and then update them to allow the required ports.
73+
- This task will take a few minutes to complete. Wait for this to finish to avoid race conditions.
74+
8. Check the flavors you want to deploy and CAPZ will deploy the workload cluster with the selected flavor.
75+
- Flavors that leverage internal load balancer and are available for development in CAPZ for MSFT Tenant:
76+
- [apiserver-ilb](https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/templates/cluster-template-apiserver-ilb.yaml): VM-based default flavor that brings up native K8s clusters with Linux nodes.
77+
- [apiserver-ilb-windows](https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/templates/cluster-template-windows-apiserver-ilb.yaml): VM-based flavor that brings up native K8s clusters with Linux and Windows nodes.
3478

3579
## Leveraging internal load balancer
3680

3781
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.
3882

39-
4083
### Challenges and Solutions
4184

4285
1. **Management to Workload Cluster Connectivity**
@@ -85,42 +128,3 @@ By default using Tilt with Cluster API Provider Azure (CAPZ), the management clu
85128
- Use 3 control plane nodes in a stacked etcd setup.
86129
- Using aks as management cluster sets `CONTROL_PLANE_MACHINE_COUNT` to 3 by default.
87130

88-
##### Flavors leveraging internal load balancer
89-
90-
There are two flavors available for development in CAPZ for MSFT Tenant:
91-
- [apiserver-ilb](../../../../templates/cluster-template-apiserver-ilb.yaml): VM based default flavor that brings up native K8s clusters with Linux nodes.
92-
- [apiserver-ilb-windows](../../../../templates/cluster-template-windows-apiserver-ilb.yaml): VM based flavor that brings up native K8s clusters with Linux and Windows nodes.
93-
94-
#### Tilt Workflow for AKS as Management Cluster with Internal Load Balancer
95-
96-
- 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:
97-
```
98-
.
99-
.
100-
kustomize_substitutions:
101-
"SUBSCRIPTION_TYPE": "corporate"
102-
.
103-
```
104-
- `make clean`
105-
- This make target does not need to be run every time. Run it to remove bin and kubeconfigs.
106-
- `make generate`
107-
- 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.
108-
- Run it periodically upon updating your branch or if you want to make changes in your templates.
109-
- `make acr-login`
110-
- Run this make target if you have `REGISTRY` set to an Azure Container Registry.
111-
- `make aks-create`
112-
- Run this target to bring up an AKS cluster.
113-
- 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.
114-
- Running `make aks-create` cleans up any existing `aks_as_mgmt_settings`.
115-
- `make tilt-up`
116-
- Run this target to use underlying cluster being pointed by your `KUBECONFIG`.
117-
118-
Once the tilt UI is up and running
119-
- Click on the `allow required ports on mgmt cluster` task to allow the required ports on the management cluster's API server.
120-
- Note: This task will wait for the NSG rules to be created and then update them to allow the required ports.
121-
- This task will take a few minutes to complete.
122-
- This target can run in parallel and independent of deploying any cluster flavors.
123-
- Click on the flavors you want to deploy and CAPZ will deploy the workload cluster with the selected flavor.
124-
- Flavors that leverage internal load balancer are:
125-
- `apiserver-ilb`
126-
- `windows-apiserver-ilb`

0 commit comments

Comments
 (0)