Skip to content

Commit b484c18

Browse files
committed
Learn Editor: Update howto-prepare-cluster.md
1 parent 3e9ec76 commit b484c18

File tree

1 file changed

+140
-2
lines changed

1 file changed

+140
-2
lines changed

articles/iot-operations/deploy-iot-ops/howto-prepare-cluster.md

Lines changed: 140 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,38 @@ To prepare an Azure Arc-enabled Kubernetes cluster, you need:
7373

7474
* [Azure IoT Operations supported environments](./overview-deploy.md#supported-environments).
7575
* [Azure Arc-enabled Kubernetes system requirements](/azure/azure-arc/kubernetes/system-requirements).
76+
77+
### [Tanzu Kubernetes Grid with a Management Cluster](#tab/tkgm)
7678

79+
To prepare a TKGm workload cluster, you need:
80+
81+
- An Azure subscription with either the Owner role or a combination of Contributor and User Access Administrator roles. You can check your access level by navigating to your subscription, selecting Access control (IAM) on the left-hand side of the Azure portal, and then selecting View my access. If you don't have an Azure subscription, [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
82+
83+
- An Azure resource group. Only one Azure IoT Operations instance is supported per resource group. To create a new resource group, use the [az group create](/cli/azure/group#az-group-create) command. For the list of currently supported Azure regions, see [Supported regions](../overview-iot-operations.md#supported-regions).
84+
85+
86+
```azurecli
87+
az group create --location <REGION> --resource-group <RESOURCE_GROUP> --subscription <SUBSCRIPTION_ID>
88+
```
89+
90+
- Azure CLI version 2.53.0 or newer installed on your cluster machine. Use `az --version` to check your version and `az upgrade` to update if necessary. For more information, see [How to install the Azure CLI](/cli/azure/install-azure-cli).
91+
92+
- The latest version of the **connectedk8s** extension for Azure CLI:
93+
94+
95+
```bash
96+
az extension add --upgrade --name connectedk8s
97+
```
98+
99+
- [Tanzu Kubernetes Grid with a standalone management cluster.](https://techdocs.broadcom.com/us/en/vmware-tanzu/standalone-components/tanzu-kubernetes-grid/2-5/tkg/mgmt-index.html)
100+
101+
- Hardware that meets the system requirements:
102+
103+
- [Azure IoT Operations supported environments](./overview-deploy.md#supported-environments).
104+
- [Azure Arc-enabled Kubernetes system requirements](/azure/azure-arc/kubernetes/system-requirements).
105+
106+
- [TKGm requirements.](https://techdocs.broadcom.com/us/en/vmware-tanzu/standalone-components/tanzu-kubernetes-grid/2-5/tkg/mgmt-reqs-index.html)
107+
77108
---
78109

79110
## Create and Arc-enable a cluster
@@ -238,9 +269,116 @@ By default, a Kubernetes cluster is created with a node pool that can run Linux
238269

239270
Then, once you have an Azure Arc-enabled Kubernetes cluster, you can [deploy Azure IoT Operations](howto-deploy-iot-operations.md).
240271

241-
---
272+
### [Tanzu Kubernetes Grid with a Management Cluster](#tab/tkgm)
273+
274+
To prepare a TKGm workload cluster:
275+
276+
1. Create a single-node or multi-node TKGm workload cluster. For guidance, see the [Tanzu documentation](https://techdocs.broadcom.com/us/en/vmware-tanzu/standalone-components/tanzu-kubernetes-grid/2-5/tkg/workload-clusters-index.html).
277+
278+
1. SSH to one of the control plane VMs that is created. Once on the control plane VM, run the following:
279+
280+
281+
```bash
282+
mkdir ~/.kube
283+
sudo cp /etc/kubernetes/admin.conf ~/.kube/config
284+
sudo chown <user>:<user> ~/.kube/config
285+
kubectl get pods -A
286+
```
287+
288+
### Arc-enable your cluster
289+
290+
Connect your cluster to Azure Arc so that it can be managed remotely.
291+
292+
1. On the machine where you deployed the Kubernetes cluster, sign into Azure CLI with your Microsoft Entra user account that has the required role(s) for the Azure subscription:
293+
294+
295+
```azurecli
296+
az login
297+
```
298+
299+
If at any point you get an error that says *Your device is required to be managed to access your resource*, run `az login` again and make sure that you sign in interactively with a browser.
300+
301+
1. After you sign in, the Azure CLI displays all of your subscriptions and indicates your default subscription with an asterisk `*`. To continue with your default subscription, select `Enter`. Otherwise, type the number of the Azure subscription that you want to use.
302+
303+
1. Register the required resource providers in your subscription.
304+
305+
306+
```
307+
Note
308+
This step only needs to be run once per subscription. To register resource providers, you need permission to do the /register/action operation, which is included in subscription Contributor and Owner roles. For more information, see Azure resource providers and types.
309+
```
310+
311+
312+
```azurecli
313+
az provider register -n "Microsoft.ExtendedLocation"
314+
az provider register -n "Microsoft.Kubernetes"
315+
az provider register -n "Microsoft.KubernetesConfiguration"
316+
az provider register -n "Microsoft.IoTOperations"
317+
az provider register -n "Microsoft.DeviceRegistry"
318+
az provider register -n "Microsoft.SecretSyncController"
319+
```
320+
321+
1. Use the [az connectedk8s connect](/cli/azure/connectedk8s) command to Arc-enable your Kubernetes cluster and manage it as part of your Azure resource group.
322+
323+
324+
```azurecli
325+
az connectedk8s connect --name <CLUSTER_NAME> -l <REGION> --resource-group <RESOURCE_GROUP> --subscription <SUBSCRIPTION_ID> --enable-oidc-issuer --enable-workload-identity --disable-auto-upgrade
326+
```
327+
328+
To prevent unplanned updates to Azure Arc and the system Arc extensions that Azure IoT Operations uses as dependencies, this command disables autoupgrade. Instead, [manually upgrade agents](/azure/azure-arc/kubernetes/agent-upgrade) as needed.
329+
330+
**Important**
331+
332+
If your environment uses a proxy server or Azure Arc Gateway, modify the `az connectedk8s connect` command with your proxy information:
333+
334+
1. Follow the instructions in either **[Connect using an outbound proxy server](/azure/azure-arc/kubernetes/quickstart-connect-cluster)** or **[Onboard Kubernetes clusters to Azure Arc with Azure Arc Gateway](/azure/azure-arc/kubernetes/arc-gateway-simplify-networking)**.
335+
1. Add `169.254.169.254` to the `--proxy-skip-range` parameter of the `az connectedk8s connect` command. **[Azure Device Registry](/editor/meenag16/azure-docs-pr/articles%2Fiot-operations%2Fdeploy-iot-ops%2Fhowto-prepare-cluster.md/docs-editor%2Foverview-iot-operations-1748623408/discover-manage-assets/overview-manage-assets.md)** uses this local endpoint to get access tokens for authorization.
336+
337+
Azure IoT Operations doesn't support proxy servers that require a trusted certificate.
338+
339+
1. Get the cluster's issuer URL.
340+
341+
342+
```azurecli
343+
az connectedk8s show --resource-group <RESOURCE_GROUP> --name <CLUSTER_NAME> --query oidcIssuerProfile.issuerUrl --output tsv
344+
```
345+
346+
Save the output of this command to use in the next steps.
347+
348+
1. SSH to a TKGm management cluster. Edit the custom resource for the workload cluster with the issuer URL from the previous step.
349+
350+
351+
```azurecli
352+
kubectl edit cluster <WORKLOAD_CLUSTER_NAME>
353+
```
354+
355+
1. Add the following content to the `config.yaml` file, replacing the <OIDC_ISSUER_URL> placeholder with your cluster's issuer URL.
356+
357+
358+
```yaml
359+
- name: apiServerExtraArgs
360+
value: {"service-account-issuer":"<OIDC_ISSUER_URL>"}
361+
```
362+
363+
1. Use the [az connectedk8s enable-features](/cli/azure/connectedk8s) command to enable the custom location feature on your Arc cluster. This command uses the OBJECT_ID environment variable saved from the previous step to set the value for the custom-locations-oid parameter. Run this command on the machine where you deployed the Kubernetes cluster:
364+
365+
Azure CLIEdit development language
366+
367+
368+
```azurecli
369+
az connectedk8s enable-features -n <CLUSTER_NAME> -g <RESOURCE_GROUP> --custom-locations-oid $OBJECT_ID --features cluster-connect custom-locations
370+
```
371+
372+
### Update Pod Security Admission Settings
373+
374+
Before deploying Azure IoT Operations, you will need to update the Pod Security Admission settings on your TKGm cluster. Applying this file will pre-create namespace labels and set pod security to `privileged`.
375+
376+
377+
```azurecli
378+
kubectl apply -f <link to repo>
379+
```
242380

243-
## Advanced configuration
381+
## Advanced Configuration
244382

245383
At this point, when you have an Azure Arc-enabled Kubernetes cluster but before you deploy Azure IoT Operations to it, you might want to configure your cluster for advanced scenarios.
246384

0 commit comments

Comments
 (0)