Skip to content

Commit 78c8c65

Browse files
authored
Merge pull request #274173 from kgremban/may2-qscodespace
Reorganize deployment qs and how-tos
2 parents cf1bf43 + a8f11c5 commit 78c8c65

File tree

7 files changed

+234
-293
lines changed

7 files changed

+234
-293
lines changed

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

Lines changed: 200 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: dobett
66
ms.subservice: orchestrator
77
ms.topic: how-to
88
ms.custom: ignite-2023, devx-track-azurecli
9-
ms.date: 12/07/2023
9+
ms.date: 05/02/2024
1010

1111
#CustomerIntent: As an IT professional, I want prepare an Azure-Arc enabled Kubernetes cluster so that I can deploy Azure IoT Operations to it.
1212
---
@@ -26,22 +26,91 @@ An Azure Arc-enabled Kubernetes cluster is a prerequisite for deploying Azure Io
2626

2727
To prepare your Azure Arc-enabled Kubernetes cluster, you need:
2828

29-
- An Azure subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
30-
- [Azure CLI version 2.46.0 or newer installed](/cli/azure/install-azure-cli) on your development machine.
3129
- Hardware that meets the [system requirements](../../azure-arc/kubernetes/system-requirements.md).
3230

33-
### Create a cluster
31+
### [AKS Edge Essentials](#tab/aks-edge-essentials)
32+
33+
* An Azure subscription. If you don't have an Azure subscription, [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
34+
35+
* Azure CLI version 2.46.0 or newer installed on your development 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).
36+
37+
* The Azure IoT Operations extension for Azure CLI. Use the following command to add the extension or update it to the latest version:
38+
39+
```bash
40+
az extension add --upgrade --name azure-iot-ops
41+
```
42+
43+
* Hardware that meets the system requirements:
44+
45+
* Ensure that your machine has a minimum of 10-GB RAM, 4 vCPUs, and 40-GB free disk space.
46+
* Review the [AKS Edge Essentials requirements and support matrix](/azure/aks/hybrid/aks-edge-system-requirements).
47+
* Review the [AKS Edge Essentials networking guidance](/azure/aks/hybrid/aks-edge-concept-networking).
48+
49+
50+
### [Ubuntu](#tab/ubuntu)
51+
52+
* An Azure subscription. If you don't have an Azure subscription, [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
53+
54+
* Azure CLI version 2.46.0 or newer installed on your development 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).
55+
56+
* The Azure IoT Operations extension for Azure CLI. Use the following command to add the extension or update it to the latest version:
57+
58+
```bash
59+
az extension add --upgrade --name azure-iot-ops
60+
```
61+
62+
* Review the [K3s requirements](https://docs.k3s.io/installation/requirements).
63+
64+
Azure IoT Operations also works on Ubuntu in Windows Subsystem for Linux (WSL) on your Windows machine. Use WSL for testing and development purposes only.
65+
66+
To set up your WSL Ubuntu environment:
67+
68+
1. [Install Linux on Windows with WSL](/windows/wsl/install).
69+
70+
1. Enable `systemd`:
71+
72+
```bash
73+
sudo -e /etc/wsl.conf
74+
```
75+
76+
Add the following to _wsl.conf_ and then save the file:
77+
78+
```text
79+
[boot]
80+
systemd=true
81+
```
82+
83+
1. After you enable `systemd`, [re-enable running windows executables from WSL](https://github.com/microsoft/WSL/issues/8843):
84+
85+
```bash
86+
sudo sh -c 'echo :WSLInterop:M::MZ::/init:PF > /usr/lib/binfmt.d/WSLInterop.conf'
87+
sudo systemctl unmask systemd-binfmt.service
88+
sudo systemctl restart systemd-binfmt
89+
sudo systemctl mask systemd-binfmt.service
90+
```
91+
92+
### [Codespaces](#tab/codespaces)
93+
94+
* An Azure subscription. If you don't have an Azure subscription, [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
95+
96+
* A [GitHub](https://github.com) account.
97+
98+
* Visual Studio Code installed on your development machine. For more information, see [Download Visual Studio Code](https://code.visualstudio.com/download).
99+
100+
---
101+
102+
## Create a cluster
34103
35104
This section provides steps to prepare and Arc-enable clusters in validated environments on Linux and Windows as well as GitHub Codespaces in the cloud.
36105
37-
# [AKS Edge Essentials](#tab/aks-edge-essentials)
106+
### [AKS Edge Essentials](#tab/aks-edge-essentials)
38107
39108
[Azure Kubernetes Service Edge Essentials](/azure/aks/hybrid/aks-edge-overview) is an on-premises Kubernetes implementation of Azure Kubernetes Service (AKS) that automates running containerized applications at scale. AKS Edge Essentials includes a Microsoft-supported Kubernetes platform that includes a lightweight Kubernetes distribution with a small footprint and simple installation experience, making it easy for you to deploy Kubernetes on PC-class or "light" edge hardware.
40109
41110
>[!TIP]
42111
>You can use the [AksEdgeQuickStartForAio.ps1](https://github.com/Azure/AKS-Edge/blob/main/tools/scripts/AksEdgeQuickStart/AksEdgeQuickStartForAio.ps1) script to automate the steps in this section and connect your cluster.
43112
>
44-
>In an elevated PowerShell window, run the following commands:
113+
>Open an elevated PowerShell window, change the directory to a working folder, then run the following commands:
45114
>
46115
>```powershell
47116
>$url = "https://raw.githubusercontent.com/Azure/AKS-Edge/main/tools/scripts/AksEdgeQuickStart/AksEdgeQuickStartForAio.ps1"
@@ -75,69 +144,161 @@ Set up an AKS Edge Essentials cluster on your machine.
75144
kubectl apply -f https://raw.githubusercontent.com/Azure/AKS-Edge/main/samples/storage/local-path-provisioner/local-path-storage.yaml
76145
```
77146
78-
## Arc-enable your cluster
147+
Run the following commands to check that the deployment was successful:
79148
80-
To connect your cluster to Azure Arc, complete the steps in [Connect your AKS Edge Essentials cluster to Arc](/azure/aks/hybrid/aks-edge-howto-connect-to-arc).
149+
```powershell
150+
Import-Module AksEdge
151+
Get-AksEdgeDeploymentInfo
152+
```
81153
82-
# [Ubuntu](#tab/ubuntu)
154+
In the output of the `Get-AksEdgeDeploymentInfo` command, you should see that the cluster's Arc status is `Connected`.
83155

84-
[!INCLUDE [prepare-ubuntu](../includes/prepare-ubuntu.md)]
156+
### [Ubuntu](#tab/ubuntu)
85157

86-
## Arc-enable your cluster
158+
Azure IoT Operations should work on any CNCF-conformant kubernetes cluster. For Ubuntu Linux, Microsoft currently supports K3s clusters.
159+
160+
> [!IMPORTANT]
161+
> If you're using Ubuntu in Windows Subsystem for Linux (WSL), run all of these steps in your WSL environment, including the Azure CLI steps for configuring your cluster.
162+
163+
To prepare a K3s Kubernetes cluster on Ubuntu:
164+
165+
1. Run the K3s installation script:
166+
167+
```bash
168+
curl -sfL https://get.k3s.io | sh -
169+
```
170+
171+
For full installation information, see the [K3s quick-start guide](https://docs.k3s.io/quick-start).
87172
88-
[!INCLUDE [connect-cluster](../includes/connect-cluster.md)]
173+
1. Create a K3s configuration yaml file in `.kube/config`:
89174
90-
# [Codespaces](#tab/codespaces)
175+
```bash
176+
mkdir ~/.kube
177+
sudo KUBECONFIG=~/.kube/config:/etc/rancher/k3s/k3s.yaml kubectl config view --flatten > ~/.kube/merged
178+
mv ~/.kube/merged ~/.kube/config
179+
chmod 0600 ~/.kube/config
180+
export KUBECONFIG=~/.kube/config
181+
#switch to k3s context
182+
kubectl config use-context default
183+
```
184+
185+
1. Run the following command to increase the [user watch/instance limits](https://www.suse.com/support/kb/doc/?id=000020048).
186+
187+
```bash
188+
echo fs.inotify.max_user_instances=8192 | sudo tee -a /etc/sysctl.conf
189+
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
190+
191+
sudo sysctl -p
192+
```
193+
194+
1. For better performance, increase the file descriptor limit:
195+
196+
```bash
197+
echo fs.file-max = 100000 | sudo tee -a /etc/sysctl.conf
198+
199+
sudo sysctl -p
200+
```
201+
202+
### [Codespaces](#tab/codespaces)
91203
92204
[!INCLUDE [prepare-codespaces](../includes/prepare-codespaces.md)]
93205
206+
---
207+
94208
## Arc-enable your cluster
95209
96-
[!INCLUDE [connect-cluster](../includes/connect-cluster.md)]
210+
Connect your cluster to Azure Arc so that it can be managed remotely.
97211
98-
# [WSL Ubuntu](#tab/wsl-ubuntu)
212+
### [AKS Edge Essentials](#tab/aks-edge-essentials)
99213
100-
You can run Ubuntu in Windows Subsystem for Linux (WSL) on your Windows machine. Use WSL for testing and development purposes only.
214+
To connect your cluster to Azure Arc, complete the steps in [Connect your AKS Edge Essentials cluster to Arc](/azure/aks/hybrid/aks-edge-howto-connect-to-arc).
101215
102-
> [!IMPORTANT]
103-
> Run all of these steps in your WSL environment, including the Azure CLI steps for configuring your cluster.
216+
### [Ubuntu](#tab/ubuntu)
104217
105-
To set up your WSL Ubuntu environment:
218+
To connect your cluster to Azure Arc:
106219
107-
1. [Install Linux on Windows with WSL](/windows/wsl/install).
220+
1. On the machine where you deployed the Kubernetes cluster, or in your WSL environment, sign in with Azure CLI:
108221
109-
1. Enable `systemd`:
222+
```azurecli
223+
az login
224+
```
110225
111-
```bash
112-
sudo -e /etc/wsl.conf
113-
```
226+
1. Set environment variables for your Azure subscription, location, a new resource group, and the cluster name as it will show up in your resource group.
114227
115-
Add the following to _wsl.conf_ and then save the file:
228+
```bash
229+
# Id of the subscription where your resource group and Arc-enabled cluster will be created
230+
export SUBSCRIPTION_ID=<SUBSCRIPTION_ID>
116231
117-
```text
118-
[boot]
119-
systemd=true
120-
```
232+
# Azure region where the created resource group will be located
233+
# Currently supported regions: "eastus", "eastus2", "westus", "westus2", "westus3", "westeurope", or "northeurope"
234+
export LOCATION=<REGION>
121235
122-
1. After you enable `systemd`, [re-enable running windows executables from WSL](https://github.com/microsoft/WSL/issues/8843):
236+
# Name of a new resource group to create which will hold the Arc-enabled cluster and Azure IoT Operations resources
237+
export RESOURCE_GROUP=<NEW_RESOURCE_GROUP_NAME>
123238
124-
```bash
125-
sudo sh -c 'echo :WSLInterop:M::MZ::/init:PF > /usr/lib/binfmt.d/WSLInterop.conf'
126-
sudo systemctl unmask systemd-binfmt.service
127-
sudo systemctl restart systemd-binfmt
128-
sudo systemctl mask systemd-binfmt.service
129-
```
239+
# Name of the Arc-enabled cluster to create in your resource group
240+
export CLUSTER_NAME=<NEW_CLUSTER_NAME>
241+
```
130242
131-
[!INCLUDE [prepare-ubuntu](../includes/prepare-ubuntu.md)]
243+
1. Set the Azure subscription context for all commands:
132244
133-
## Arc-enable your cluster
245+
```azurecli
246+
az account set -s $SUBSCRIPTION_ID
247+
```
248+
249+
1. Register the required resource providers in your subscription:
250+
251+
>[!NOTE]
252+
>This step only needs to be run once per subscription.
253+
254+
```azurecli
255+
az provider register -n "Microsoft.ExtendedLocation"
256+
az provider register -n "Microsoft.Kubernetes"
257+
az provider register -n "Microsoft.KubernetesConfiguration"
258+
az provider register -n "Microsoft.IoTOperationsOrchestrator"
259+
az provider register -n "Microsoft.IoTOperationsMQ"
260+
az provider register -n "Microsoft.IoTOperationsDataProcessor"
261+
az provider register -n "Microsoft.DeviceRegistry"
262+
```
263+
264+
1. Use the [az group create](/cli/azure/group#az-group-create) command to create a resource group in your Azure subscription to store all the resources:
265+
266+
```azurecli
267+
az group create --location $LOCATION --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID
268+
```
269+
270+
1. Use the [az connectedk8s connect](/cli/azure/connectedk8s#az-connectedk8s-connect) command to Arc-enable your Kubernetes cluster and manage it as part of your Azure resource group:
271+
272+
```azurecli
273+
az connectedk8s connect -n $CLUSTER_NAME -l $LOCATION -g $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID
274+
```
275+
276+
1. Get the `objectId` of the Microsoft Entra ID application that the Azure Arc service uses and save it as an environment variable.
277+
278+
```azurecli
279+
export OBJECT_ID=$(az ad sp show --id bc313c14-388c-4e7d-a58e-70017303ee3b --query id -o tsv)
280+
```
281+
282+
1. Use the [az connectedk8s enable-features](/cli/azure/connectedk8s#az-connectedk8s-enable-features) command to enable custom location support on your cluster. This command uses the `objectId` of the Microsoft Entra ID application that the Azure Arc service uses. Run this command on the machine where you deployed the Kubernetes cluster:
283+
284+
```azurecli
285+
az connectedk8s enable-features -n $CLUSTER_NAME -g $RESOURCE_GROUP --custom-locations-oid $OBJECT_ID --features cluster-connect custom-locations
286+
```
287+
288+
### [Codespaces](#tab/codespaces)
134289
135-
[!INCLUDE [connect-cluster](../includes/connect-cluster.md)]
290+
[!INCLUDE [connect-cluster-codespaces](../includes/connect-cluster-codespaces.md)]
136291
137292
---
138293
139294
## Verify your cluster
140295
296+
To verify that your cluster is ready for Azure IoT Operations deployment, you can use the [verify-host](/cli/azure/iot/ops#az-iot-ops-verify-host) helper command in the Azure IoT Operations extension for Azure CLI. When run on the cluster host, this helper command checks connectivity to Azure Resource Manager and Microsoft Container Registry endpoints.
297+
298+
```azurecli
299+
az iot ops verify-host
300+
```
301+
141302
To verify that your Kubernetes cluster is now Azure Arc-enabled, run the following command:
142303
143304
```console
@@ -174,12 +335,6 @@ pod/resource-sync-agent-769bb66b79-z9n46 2/2 Running 0
174335
pod/metrics-agent-6588f97dc-455j8 2/2 Running 0 10m
175336
```
176337
177-
To verify that your cluster is ready for Azure IoT Operations deployment, you can use the [verify-host](/cli/azure/iot/ops#az-iot-ops-verify-host) helper command in the Azure IoT Operations extension for Azure CLI. When run on the cluster host, this helper command checks connectivity to Azure Resource Manager and Microsoft Container Registry endpoints.
178-
179-
```azurecli
180-
az iot ops verify-host
181-
```
182-
183338
## Create sites
184339
185340
To manage which clusters your OT users have access to, you can group your clusters into sites. To learn more, see [What is Azure Arc site manager (preview)?](../../azure-arc/site-manager/overview.md).

articles/iot-operations/get-started/quickstart-add-assets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ aio-akri-otel-collector-5c775f745b-g97qv 1/1 Running 3 (4h15m ago)
241241
aio-akri-agent-daemonset-mp6v7 1/1 Running 3 (4h15m ago) 2d23h
242242
```
243243

244-
On the machine where your Kubernetes cluster is running, run the following command to apply a new configuration for the discovery handler:
244+
In your Codespaces terminal, run the following command to apply a new configuration for the discovery handler:
245245

246246
```console
247-
kubectl apply -f https://raw.githubusercontent.com/Azure-Samples/explore-iot-operations/main/samples/quickstarts/akri-opcua-asset.yaml
247+
kubectl apply -f /workspaces/explore-iot-operations/samples/quickstarts/akri-opcua-asset.yaml
248248
```
249249

250250
The following snippet shows the YAML file that you applied:

0 commit comments

Comments
 (0)