Skip to content

Commit 1b20599

Browse files
committed
Learn Editor: Update howto-prepare-cluster.md
1 parent 5d57032 commit 1b20599

File tree

1 file changed

+56
-59
lines changed

1 file changed

+56
-59
lines changed

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

Lines changed: 56 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,22 @@ To prepare a Tanzu Kubernetes Grid (TKG) workload cluster, you need:
8383
- 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).
8484

8585

86-
```azurecli
87-
az group create --location <REGION> --resource-group <RESOURCE_GROUP> --subscription <SUBSCRIPTION_ID>
88-
```
86+
```azurecli
87+
az group create --location <REGION> --resource-group <RESOURCE_GROUP> --subscription <SUBSCRIPTION_ID>
88+
```
8989

9090
- 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).
9191

9292
- The latest version of the **connectedk8s** extension for Azure CLI:
9393

9494

95-
```bash
96-
az extension add --upgrade --name connectedk8s
97-
```
95+
```bash
96+
az extension add --upgrade --name connectedk8s
97+
```
9898

9999
- [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)
100100

101-
- Hardware that meets the system requirements:
101+
- Hardware that meets the system requirements:.
102102

103103
- [Azure IoT Operations supported environments](./overview-deploy.md#supported-environments).
104104
- [Azure Arc-enabled Kubernetes system requirements](/azure/azure-arc/kubernetes/system-requirements).
@@ -159,13 +159,13 @@ To prepare a K3s Kubernetes cluster on Ubuntu:
159159

160160
Connect your cluster to Azure Arc so that it can be managed remotely.
161161

162-
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:
162+
1. From a machine that has `kubectl` access to your cluster, sign into Azure CLI with your Microsoft Entra user account that has the required role(s) for the Azure subscription:
163163

164-
```azurecli
164+
```azurecli
165165
az login
166166
```
167167

168-
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.
168+
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.
169169

170170
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.
171171

@@ -271,19 +271,18 @@ Then, once you have an Azure Arc-enabled Kubernetes cluster, you can [deploy Azu
271271

272272
### [Tanzu Kubernetes Grid with a management cluster](#tab/tkgm)
273273

274-
To prepare a TKGm workload cluster:
274+
To prepare a TKGm workload cluster, you need:
275275

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).
276+
- 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).
277277

278-
1. SSH to one of the control plane VMs that is created. Once on the control plane VM, run the following:
278+
### Update pod security admission settings
279+
280+
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`.
279281

280282

281-
```bash
282-
mkdir ~/.kube
283-
sudo cp /etc/kubernetes/admin.conf ~/.kube/config
284-
sudo chown <user>:<group> ~/.kube/config
285-
kubectl get pods -A
286-
```
283+
```azurecli
284+
kubectl apply -f <link to repo>
285+
```
287286

288287
### Arc-enable your cluster
289288

@@ -292,9 +291,9 @@ Connect your cluster to Azure Arc so that it can be managed remotely.
292291
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:
293292

294293

295-
```azurecli
296-
az login
297-
```
294+
```azurecli
295+
az login
296+
```
298297

299298
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.
300299

@@ -303,65 +302,63 @@ If at any point you get an error that says *Your device is required to be manage
303302
1. Register the required resource providers in your subscription.
304303

305304

306-
```azurecli
307-
az provider register -n "Microsoft.ExtendedLocation"
308-
az provider register -n "Microsoft.Kubernetes"
309-
az provider register -n "Microsoft.KubernetesConfiguration"
310-
az provider register -n "Microsoft.IoTOperations"
311-
az provider register -n "Microsoft.DeviceRegistry"
312-
az provider register -n "Microsoft.SecretSyncController"
313-
```
305+
```azurecli
306+
az provider register -n "Microsoft.ExtendedLocation"
307+
az provider register -n "Microsoft.Kubernetes"
308+
az provider register -n "Microsoft.KubernetesConfiguration"
309+
az provider register -n "Microsoft.IoTOperations"
310+
az provider register -n "Microsoft.DeviceRegistry"
311+
az provider register -n "Microsoft.SecretSyncController"
312+
```
314313

315314
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.
316315

317316

318-
```azurecli
319-
az connectedk8s connect --name <CLUSTER_NAME> -l <REGION> --resource-group <RESOURCE_GROUP> --subscription <SUBSCRIPTION_ID> --enable-oidc-issuer --enable-workload-identity --disable-auto-upgrade
320-
```
317+
```azurecli
318+
az connectedk8s connect --name <CLUSTER_NAME> -l <REGION> --resource-group <RESOURCE_GROUP> --subscription <SUBSCRIPTION_ID> --enable-oidc-issuer --enable-workload-identity --disable-auto-upgrade
319+
```
321320

322321
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.
323322

324323
1. Get the cluster's issuer URL.
325324

326325

327-
```azurecli
328-
az connectedk8s show --resource-group <RESOURCE_GROUP> --name <CLUSTER_NAME> --query oidcIssuerProfile.issuerUrl --output tsv
329-
```
326+
```azurecli
327+
az connectedk8s show --resource-group <RESOURCE_GROUP> --name <CLUSTER_NAME> --query oidcIssuerProfile.issuerUrl --output tsv
328+
```
330329

331330
Save the output of this command to use in the next steps.
332331

333-
1. SSH to a TKGm management cluster. Edit the custom resource for the workload cluster with the issuer URL from the previous step.
334-
332+
1. Connect to the TKG management cluster. Edit the custom resource for the workload cluster with the issuer URL from the previous step.
335333

336-
```azurecli
337-
kubectl edit cluster <CLUSTER_NAME>
338-
```
334+
```azurecli
335+
kubectl edit cluster <CLUSTER_NAME>
336+
```
339337

340338
1. Add the following content to the `config.yaml` file, replacing the <OIDC_ISSUER_URL> placeholder with your cluster's issuer URL.
339+
> [!NOTE]
340+
> The URL should be copied exactly as printed by the prior command, including any characters such as `/`.
341+
```yaml
342+
- name: apiServerExtraArgs
343+
value: {"service-account-issuer":"<OIDC_ISSUER_URL>"}
344+
```
341345
346+
1. Prepare for enabling the Azure Arc service, custom location, on your Arc cluster by getting the custom location object ID and saving it as the environment variable, OBJECT_ID. You must be logged into Azure CLI with a Microsoft Entra user account to successfully run the command, not a service principal. Run the following command **exactly as written**, without changing the GUID value.
342347
343-
```yaml
344-
- name: apiServerExtraArgs
345-
value: {"service-account-issuer":"<OIDC_ISSUER_URL>"}
346-
```
347-
348-
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:
349-
350-
Azure CLIEdit development language
351-
352-
353-
```azurecli
354-
az connectedk8s enable-features -n <CLUSTER_NAME> -g <RESOURCE_GROUP> --custom-locations-oid $OBJECT_ID --features cluster-connect custom-locations
355-
```
348+
```azurecli
349+
export OBJECT_ID=$(az ad sp show --id bc313c14-388c-4e7d-a58e-70017303ee3b --query id -o tsv)
350+
```
356351

357-
### Update pod security admission settings
352+
> [!NOTE]
353+
>If you receive the error: "Unable to fetch oid of 'custom-locations' app. Proceeding without enabling the feature. Insufficient privileges to complete the operation," then your service principal might lack the necessary permissions to retrieve the object ID of the custom location. Log into Azure CLI with a Microsoft Entra user account that meets the prerequisites. For more information, see [Create and manage custom locations](https://aka.ms/enable-cl-sp).
358354
359-
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`.
355+
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:
360356

361357

362-
```azurecli
363-
kubectl apply -f <link to repo>
364-
```
358+
```azurecli
359+
az connectedk8s enable-features -n <CLUSTER_NAME> -g <RESOURCE_GROUP> --custom-locations-oid $OBJECT_ID --features cluster-connect custom-locations
360+
```
361+
---
365362

366363
## Advanced configuration
367364

0 commit comments

Comments
 (0)