Skip to content

Commit 5f2272b

Browse files
Merge branch 'main' of https://github.com/MicrosoftDocs/azure-stack-docs-pr into amlfs-templates
2 parents e52a712 + 75be9dc commit 5f2272b

17 files changed

+658
-327
lines changed

AKS-Hybrid/TOC.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
- name: Azure CLI
4848
href: aks-create-clusters-cli.md
4949
- name: Azure portal
50-
href: aks-create-clusters-portal.md
50+
href: aks-create-clusters-portal.md
51+
- name: Bicep
52+
href: create-clusters-bicep.md
5153
- name: Deploy to Azure using a quickstart template
5254
href: /samples/azure/azure-quickstart-templates/aks-on-ashci
5355
- name: Azure Resource Manager template

AKS-Hybrid/auto-scale-aks-arc.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ ms.topic: how-to
55
ms.custom: devx-track-azurecli
66
author: sethmanheim
77
ms.author: sethm
8-
ms.lastreviewed: 02/28/2024
8+
ms.date: 08/01/2024
99
ms.reviewer: abha
10-
ms.date: 02/28/2024
10+
ms.lastreviewed: 08/01/2024
1111

1212
# Intent: As a Kubernetes user, I want to use cluster autoscaling to grow my nodes to keep up with application demand.
1313
# Keyword: cluster autoscaling Kubernetes
@@ -59,7 +59,7 @@ It takes a few minutes to update the cluster and configure the cluster autoscale
5959
Disable the cluster autoscaler using the [`az aksarc update`](/cli/azure/aksarc#az-aksarc-update) command and the `--disable-cluster-autoscaler` parameter:
6060

6161
```azurecli-interactive
62-
az aks update \
62+
az aksarc update \
6363
--resource-group myResourceGroup \
6464
--name my-aks-arc-cluster \
6565
--disable-cluster-autoscaler
@@ -72,7 +72,7 @@ Nodes aren't removed when the cluster autoscaler is disabled.
7272
As your application demands change, you might need to adjust the cluster autoscaler node count to scale efficiently. Change the node count using the [`az aksarc update`](/cli/azure/aksarc#az-aksarc-update) command and update the cluster autoscaler using the `--update-cluster-autoscaler` parameter and specifying your updated `--min-count` and `--max-count` for the node.
7373

7474
```azurecli-interactive
75-
az aks update \
75+
az aksarc update \
7676
--resource-group myResourceGroup \
7777
--name myAKSCluster \
7878
--update-cluster-autoscaler \

AKS-Hybrid/azure-rbac-23h2.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,7 @@ After a few minutes, the command completes and returns JSON-formatted informatio
6969

7070
## Step 2: Create role assignments for users to access the cluster
7171

72-
AKS enabled by Azure Arc provides the following built-in roles:
73-
74-
| Role | Description |
75-
| ------------------------------------------------------------ | ------------------------------------------------------------ |
76-
| [Azure Arc Kubernetes Viewer](/azure/role-based-access-control/built-in-roles#azure-arc-kubernetes-viewer) | Allows read-only access to see most objects in a namespace. <br />Doesn't allow viewing roles or role bindings. <br />Doesn't allow viewing `secrets`, because `read` permission on secrets enables access to `ServiceAccount` credentials in the namespace, which allows API access as any `ServiceAccount` in the namespace (a form of privilege escalation). |
77-
| [Azure Arc Kubernetes Writer](/azure/role-based-access-control/built-in-roles#azure-arc-kubernetes-writer) | Allows read/write access to most objects in a namespace. <br />Doesn't allow viewing or modifying roles or role bindings. <br />Allows accessing `secrets` and running pods as any `ServiceAccount` in the namespace, so it can be used to gain the API access levels of any `ServiceAccount` in the namespace. |
78-
| [Azure Arc Kubernetes Admin](/azure/role-based-access-control/built-in-roles#azure-arc-kubernetes-admin) | Allows admin access, intended to be granted within a namespace. <br />Allows read/write access to most resources in a namespace (or cluster scope), including the ability to create roles and role bindings within the namespace. <br />Doesn't allow write access to resource quota or to the namespace itself. |
79-
| [Azure Arc Kubernetes Cluster Admin](/azure/role-based-access-control/built-in-roles#azure-arc-kubernetes-cluster-admin) | Allows "super-user" access to perform any action on any resource.<br/>Gives full control over every resource in the cluster and in all namespaces. |
72+
[!INCLUDE [built-in-roles](includes/built-in-roles.md)]
8073

8174
You can use the [`az role assignment create`](/cli/azure/role/assignment#az-role-assignment-create) command to create role assignments.
8275

AKS-Hybrid/cluster-labels.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: Use cluster labels in AKS enabled by Azure Arc
33
description: Learn how to use labels in Kubernetes clusters in AKS enabled by Arc.
44
ms.topic: how-to
5-
ms.date: 05/31/2024
5+
ms.date: 08/01/2024
66
author: sethmanheim
77
ms.author: sethm
8-
ms.lastreviewed: 05/31/2024
8+
ms.lastreviewed: 08/01/2024
99
ms.reviewer: guanghu
1010

1111
---
@@ -39,7 +39,7 @@ This article describes how to use labels in a Kubernetes cluster on AKS enabled
3939
The following example creates a node pool named `labelnp` with the label `dept=HR`:
4040

4141
```azurecli
42-
az aks nodepool add –resource-group myResourceGroup –cluster-name myAKSCluster –name labelnp –node-count 1 –labels dept=HR –no-wait
42+
az aksarc nodepool add –resource-group myResourceGroup –cluster-name myAKSCluster –name labelnp –node-count 1 –labels dept=HR –no-wait
4343
```
4444

4545
The following example output from the [`az aksarc nodepool list`](/cli/azure/aksarc/nodepool#az-aksarc-nodepool-list) command shows the `labelnp` node pool creates nodes with the specified `nodeLabels`:

AKS-Hybrid/concepts-security-access-identity.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ title: Access and identity options for Azure Kubernetes Service (AKS) Arc
33
description: Learn about options in access and identity management on a Kubernetes cluster in AKS on Azure Stack HCI.
44
author: leslielin
55
ms.topic: conceptual
6-
ms.date: 07/16/2024
6+
ms.date: 07/30/2024
77
ms.author: leslielin
8-
ms.lastreviewed: 06/03/2024
8+
ms.lastreviewed: 07/30/2024
99
ms.reviewer: abha
1010

1111
# Intent: As an IT Pro, I want to learn how to improve the security of the applications and infrastructure within my AKS on Azure Stack HCI deployment(s).
@@ -117,15 +117,7 @@ With this feature, you not only give users permissions to the AKS resource acros
117117
118118
### Built-in roles
119119

120-
AKS enabled by Azure Arc provides the following four built-in roles. They are similar to the [Kubernetes built-in roles](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) with a few differences, such as supporting CRDs. See the full list of actions allowed by each [Azure built-in role](/azure/role-based-access-control/built-in-roles).
121-
122-
| Role | Description |
123-
| ------------------------------------------------------------ | ------------------------------------------------------------ |
124-
| [Azure Arc-enabled Kubernetes Cluster User Role](/azure/role-based-access-control/built-in-roles/containers#azure-arc-enabled-kubernetes-cluster-user-role) | Allows you to retrieve the Cluster Connect-based kubeconfig file to manage clusters from anywhere. |
125-
| [Azure Arc Kubernetes Viewer](/azure/role-based-access-control/built-in-roles/containers#azure-arc-kubernetes-viewer) | Allows read-only access to see most objects in a namespace. <br />Doesn't allow viewing roles or role bindings. <br />Doesn't allow viewing `secrets`, because `read` permission on secrets enables access to `ServiceAccount` credentials in the namespace, which allows API access as any `ServiceAccount` in the namespace (a form of privilege escalation). |
126-
| [Azure Arc Kubernetes Writer](/azure/role-based-access-control/built-in-roles/containers#azure-arc-kubernetes-writer) | Allows read/write access to most objects in a namespace. <br />Doesn't allow viewing or modifying roles or role bindings. <br />Allows accessing `secrets` and running pods as any `ServiceAccount` in the namespace, so it can be used to gain the API access levels of any `ServiceAccount` in the namespace. |
127-
| [Azure Arc Kubernetes Admin](/azure/role-based-access-control/built-in-roles/containers#azure-arc-kubernetes-admin) | Allows admin access, intended to be granted within a namespace. <br />Allows read/write access to most resources in a namespace (or cluster scope), including the ability to create roles and role bindings within the namespace. <br />Doesn't allow write access to resource quota or to the namespace itself. |
128-
| [Azure Arc Kubernetes Cluster Admin](/azure/role-based-access-control/built-in-roles/containers#azure-arc-kubernetes-cluster-admin) | Allows super-user access to perform any action on any resource.<br/>Gives full control over every resource in the cluster and in all namespaces. |
120+
[!INCLUDE [built-in-roles](includes/built-in-roles.md)]
129121

130122
## Microsoft Entra integration
131123

@@ -151,11 +143,6 @@ The following table contains a summary of how users can authenticate to Kubernet
151143
3. Run `kubectl` commands.
152144
- The first command can trigger browser-based authentication to authenticate to the Kubernetes cluster, as described in the following table.
153145

154-
In the Azure portal, you can find:
155-
156-
- The *Role assignment* (Azure RBAC role grant) referred to in the second column is shown on the **Access Control (IAM)** tab.
157-
- The Cluster Admin Microsoft Entra group is shown on the **Configuration** tab.
158-
- You can also use the `--aad-admin-group-object-ids` parameter in the Azure CLI.
159146

160147
| Description | Role grant required | Cluster admin Microsoft Entra groups | When to use |
161148
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |

AKS-Hybrid/create-clusters-bicep.md

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
---
2+
title: Create Kubernetes clusters using Bicep
3+
description: Learn how to create Kubernetes clusters in Azure Stack HCI using Bicep.
4+
ms.topic: how-to
5+
ms.custom: devx-track-azurecli
6+
ms.date: 07/26/2024
7+
author: sethmanheim
8+
ms.author: sethm
9+
ms.reviewer: haojiehang
10+
ms.lastreviewed: 07/24/2024
11+
12+
---
13+
14+
# Create Kubernetes clusters using Bicep
15+
16+
This article describes how to create Kubernetes clusters in Azure Stack HCI using Bicep. The workflow is as follows:
17+
18+
1. Create an SSH key pair
19+
1. Create a Kubernetes cluster in Azure Stack HCI 23H2 using Bicep. By default, the cluster is Azure Arc-connected.
20+
1. Validate the deployment and connect to the cluster.
21+
22+
## Before you begin
23+
24+
Before you begin, make sure you have the following prerequisites:
25+
26+
1. Get the following details from your on-premises infrastructure administrator:
27+
28+
- Azure subscription ID: the Azure subscription ID that uses Azure Stack HCI for deployment and registration.
29+
- Custom location name or ID: the Azure Resource Manager ID of the custom location. The custom location is configured during the Azure Stack HCI cluster deployment. Your infrastructure admin should give you the Resource Manager ID of the custom location. This parameter is required in order to create Kubernetes clusters. You can also get the Resource Manager ID using `az customlocation show --name "<custom location name>" --resource-group <azure resource group> --query "id" -o tsv`, if the infrastructure admin provides a custom location name and resource group name.
30+
- Logical network name or ID: the Azure Resource Manager ID of the Azure Stack HCI logical network that was created following these steps. Your admin should give you the ID of the logical network. This parameter is required in order to create Kubernetes clusters. You can also get the Azure Resource Manager ID using `az stack-hci-vm network lnet show --name "<lnet name>" --resource-group <azure resource group> --query "id" -o tsv` if you know the resource group in which the logical network was created.
31+
32+
1. Make sure you have the [latest version of Azure CLI](/cli/azure/install-azure-cli) on your development machine. You can also upgrade your Azure CLI version using `az upgrade`.
33+
1. Download and install **kubectl** on your development machine. The Kubernetes command-line tool, **kubectl**, enables you to run commands against Kubernetes clusters. You can use **kubectl** to deploy applications, inspect and manage cluster resources, and view logs.
34+
35+
## Create an SSH key pair
36+
37+
To create an SSH key pair (same as Azure AKS), use the following procedure:
38+
39+
1. [Open a Cloud Shell session](https://shell.azure.com) in your browser.
40+
1. Create an SSH key pair using the `az sshkey create` Azure CLI command or the `ssh-keygen` command:
41+
42+
```azurecli
43+
# Create an SSH key pair using Azure CLI
44+
az sshkey create --name "mySSHKey" --resource-group "myResourceGroup"
45+
```
46+
47+
Or, create an SSH key pair using `ssh-keygen`:
48+
49+
```bash
50+
ssh-keygen -t rsa -b 4096
51+
```
52+
53+
For more information about creating SSH keys, see [Create and manage SSH keys for authentication in Azure](/azure/virtual-machines/linux/create-ssh-keys-detailed).
54+
55+
## Update and review the Bicep scripts
56+
57+
This section shows the Bicep parameter and template files. These files are also available in an [Azure Quickstart template](https://github.com/Azure/azure-quickstart-templates).
58+
59+
### Bicep parameter file: aksarc.bicepparam
60+
61+
```bicep
62+
using 'main.bicep'
63+
param aksClusterName = 'aksarc-bicep-new'
64+
param aksControlPlaneIP = 'x.x.x.x'
65+
param sshPublicKey = 'ssh_public_key'
66+
param hciLogicalNetworkName = 'lnet_name'
67+
param hciCustomLocationName = 'cl_name'
68+
param aksNodePoolOSType = 'Linux'
69+
param aksNodePoolNodeCount = 1
70+
```
71+
72+
### Bicep template file: main.bicep
73+
74+
```bicep
75+
@description('The name of AKS Arc cluster resource')
76+
param aksClusterName string
77+
param location string = 'eastus'
78+
79+
// Default to 1 node CP
80+
@description('The name of AKS Arc cluster control plane IP, provide this parameter during deployment')
81+
param aksControlPlaneIP string
82+
param aksControlPlaneNodeSize string = 'Standard_A4_v2'
83+
param aksControlPlaneNodeCount int = 1
84+
85+
// Default to 1 node NP
86+
param aksNodePoolName string = 'nodepool1'
87+
param aksNodePoolNodeSize string = 'Standard_A4_v2'
88+
param aksNodePoolNodeCount int = 1
89+
@allowed(['Linux', 'Windows'])
90+
param aksNodePoolOSType string = 'Linux'
91+
92+
@description('SSH public key used for cluster creation, provide this parameter during deployment')
93+
param sshPublicKey string
94+
95+
// Build LNet ID from LNet name
96+
@description('The name of LNet resource, provide this parameter during deployment')
97+
param hciLogicalNetworkName string
98+
resource logicalNetwork 'Microsoft.AzureStackHCI/logicalNetworks@2023-09-01-preview' existing = {
99+
name: hciLogicalNetworkName
100+
}
101+
102+
// Build custom location ID from custom location name
103+
@description('The name of custom location resource, provide this parameter during deployment')
104+
param hciCustomLocationName string
105+
var customLocationId = resourceId('Microsoft.ExtendedLocation/customLocations', hciCustomLocationName)
106+
107+
// Create the connected cluster. This is the Arc representation of the AKS cluster, used to create a Managed Identity for the provisioned cluster.
108+
resource connectedCluster 'Microsoft.Kubernetes/ConnectedClusters@2024-01-01' = {
109+
location: location
110+
name: aksClusterName
111+
identity: {
112+
type: 'SystemAssigned'
113+
}
114+
kind: 'ProvisionedCluster'
115+
properties: {
116+
agentPublicKeyCertificate: ''
117+
aadProfile: {
118+
enableAzureRBAC: false
119+
}
120+
}
121+
}
122+
123+
// Create the provisioned cluster instance. This is the actual AKS cluster and provisioned on your HCI cluster via the Arc Resource Bridge.
124+
resource provisionedClusterInstance 'Microsoft.HybridContainerService/provisionedClusterInstances@2024-01-01' = {
125+
name: 'default'
126+
scope: connectedCluster
127+
extendedLocation: {
128+
type: 'CustomLocation'
129+
name: customLocationId
130+
}
131+
properties: {
132+
linuxProfile: {
133+
ssh: {
134+
publicKeys: [
135+
{
136+
keyData: sshPublicKey
137+
}
138+
]
139+
}
140+
}
141+
controlPlane: {
142+
count: aksControlPlaneNodeCount
143+
controlPlaneEndpoint: {
144+
hostIP: aksControlPlaneIP
145+
}
146+
vmSize: aksControlPlaneNodeSize
147+
}
148+
networkProfile: {
149+
loadBalancerProfile: {
150+
count: 0
151+
}
152+
networkPolicy: 'calico'
153+
}
154+
agentPoolProfiles: [
155+
{
156+
name: aksNodePoolName
157+
count: aksNodePoolNodeCount
158+
vmSize: aksNodePoolNodeSize
159+
osType: aksNodePoolOSType
160+
}
161+
]
162+
cloudProviderProfile: {
163+
infraNetworkProfile: {
164+
vnetSubnetIds: [
165+
logicalNetwork.id
166+
]
167+
}
168+
}
169+
storageProfile: {
170+
nfsCsiDriver: {
171+
enabled: true
172+
}
173+
smbCsiDriver: {
174+
enabled: true
175+
}
176+
}
177+
}
178+
}
179+
```
180+
181+
The **Microsoft.HybridContainerService/provisionedClusterInstances** resource is defined in the Bicep file. If you want to explore more properties, [see the API reference](/azure/templates/microsoft.hybridcontainerservice/provisionedclusterinstances?pivots=deployment-language-bicep).
182+
183+
## Deploy the Bicep file
184+
185+
1. Save the Bicep file as **main.bicep** to your local computer.
186+
1. Update the parameters defined in **aksarc.bicepparam** and save it to your local computer.
187+
1. Deploy the Bicep file using Azure CLI:
188+
189+
```azurecli
190+
az deployment group create --name BicepDeployment --resource-group myResourceGroupName --template-file main.bicep –-parameters aksarc.bicepparam
191+
```
192+
193+
## Validate the Bicep deployment and connect to the cluster
194+
195+
You can now connect to your Kubernetes cluster by running the `az connectedk8s proxy` command from your development machine. You can also use **kubectl** to see the node and pod status. Follow the same steps as described in [Connect to the Kubernetes cluster](aks-create-clusters-cli.md#connect-to-the-kubernetes-cluster).
196+
197+
## Next steps
198+
199+
[Create Kubernetes clusters using Azure CLI](aks-create-clusters-cli.md)

0 commit comments

Comments
 (0)