sigs.k8s.io/cluster-api-provider-azure@v1.14.3/docs/book/src/topics/publicmec-clusters.md (about) 1 # Deploy cluster on Public MEC 2 3 - **Feature status:** Experimental 4 - **Feature gate:** EdgeZone=true 5 6 ## Overview 7 8 <!-- markdown-link-check-disable-next-line --> 9 Cluster API Provider Azure (CAPZ) has experimental support for deploying clusters on [Azure Public MEC](https://azure.microsoft.com/solutions/public-multi-access-edge-compute-mec). Before you begin, you need an Azure subscription which has access to Public MEC. 10 11 To deploy a cluster on Public MEC, provide extended location info through environment variables and use the "edgezone" flavor. 12 13 ## Example: Deploy cluster on Public MEC by `clusterctl` 14 15 The clusterctl "edgezone" flavor exists to deploy clusters on Public MEC. This flavor requires the following environment variables to be set before executing `clusterctl`. 16 17 ```bash 18 # Kubernetes values 19 export CLUSTER_NAME="my-cluster" 20 export WORKER_MACHINE_COUNT=2 21 export CONTROL_PLANE_MACHINE_COUNT=1 22 export KUBERNETES_VERSION="v1.25.0" 23 24 # Azure values 25 export AZURE_LOCATION="eastus2euap" 26 export AZURE_EXTENDEDLOCATION_TYPE="EdgeZone" 27 export AZURE_EXTENDEDLOCATION_NAME="microsoftrrdclab3" 28 export AZURE_RESOURCE_GROUP="${CLUSTER_NAME}" 29 ``` 30 31 Create a new service principal and save to local file: 32 ```bash 33 az ad sp create-for-rbac --role Contributor --scopes="/subscriptions/${AZURE_SUBSCRIPTION_ID}" --sdk-auth > sp.json 34 ``` 35 Export the following variables to your current shell: 36 ```bash 37 export AZURE_SUBSCRIPTION_ID="$(cat sp.json | jq -r .subscriptionId | tr -d '\n')" 38 export AZURE_CLIENT_SECRET="$(cat sp.json | jq -r .clientSecret | tr -d '\n')" 39 export AZURE_CLIENT_ID="$(cat sp.json | jq -r .clientId | tr -d '\n')" 40 export AZURE_CONTROL_PLANE_MACHINE_TYPE="Standard_D2s_v3" 41 export AZURE_NODE_MACHINE_TYPE="Standard_D2s_v3" 42 export AZURE_CLUSTER_IDENTITY_SECRET_NAME="cluster-identity-secret" 43 export AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE="default" 44 export CLUSTER_IDENTITY_NAME="cluster-identity" 45 ``` 46 47 Public MEC-enabled clusters also require the following feature flags set as environment variables: 48 49 ```bash 50 export EXP_EDGEZONE=true 51 ``` 52 53 Create a local kind cluster to run the management cluster components: 54 55 ```bash 56 kind create cluster 57 ``` 58 59 Create an identity secret on the management cluster: 60 61 ```bash 62 kubectl create secret generic "${AZURE_CLUSTER_IDENTITY_SECRET_NAME}" --from-literal=clientSecret="${AZURE_CLIENT_SECRET}" 63 ``` 64 65 Execute clusterctl to template the resources: 66 67 ```bash 68 clusterctl init --infrastructure azure 69 clusterctl generate cluster ${CLUSTER_NAME} --kubernetes-version ${KUBERNETES_VERSION} --flavor edgezone > edgezone-cluster.yaml 70 ``` 71 Public MEC doesn't have access to CAPI images in Azure Marketplace, therefore, users need to prepare CAPI image by themselves. You can follow doc [Custom Images](https://capz.sigs.k8s.io/topics/custom-images.html) to setup custom image. 72 73 Apply the modified template to your kind management cluster: 74 ```bash 75 kubectl apply -f edgezone-cluster.yaml 76 ``` 77 78 Once target cluster's control plane is up, install [Azure cloud provider components](https://github.com/kubernetes-sigs/cloud-provider-azure/tree/master/helm/cloud-provider-azure) by helm. The minimum version for "out-of-tree" Azure cloud provider is v1.0.3, "in-tree" Azure cloud provider is not supported. (Reference: https://capz.sigs.k8s.io/topics/addons.html#external-cloud-provider) 79 80 ```bash 81 # get the kubeconfig of the cluster 82 kubectl get secrets ${CLUSTER_NAME}-kubeconfig -o json | jq -r .data.value | base64 --decode > ./kubeconfig 83 84 helm install --repo https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo cloud-provider-azure --generate-name --set infra.clusterName=${CLUSTER_NAME} --kubeconfig=./kubeconfig 85 ```