Skip to content

Commit 4ba815b

Browse files
authored
Merge pull request #16651 from hungry1526/main
Update Bicep doc
2 parents 50e4c35 + 2ceb08c commit 4ba815b

File tree

2 files changed

+19
-144
lines changed

2 files changed

+19
-144
lines changed

AKS-Hybrid/aks-create-clusters-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ To see the Azure Vote app in action, open a web browser to the external IP addre
247247
Run the `az aksarc delete` command to clean up the cluster you created:
248248

249249
```azurecli
250-
az aksarc delete --resource-group $aksclustername --name $resource_group
250+
az aksarc delete --name $aksclustername --resource-group $resource_group
251251
```
252252

253253
## Next steps

AKS-Hybrid/create-clusters-bicep.md

Lines changed: 18 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -36,163 +36,38 @@ Before you begin, make sure you have the following prerequisites:
3636

3737
To create an SSH key pair (same as Azure AKS), use the following procedure:
3838

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:
39+
1. [Open a Cloud Shell session](https://shell.azure.com) in your browser or open a terminal on your local machine.
40+
1. Create an SSH key pair using `az sshkey create`:
4141

4242
```azurecli
43-
# Create an SSH key pair using Azure CLI
44-
az sshkey create --name "mySSHKey" --resource-group "myResourceGroup"
43+
az sshkey create --name <Public_SSH_Key> --resource-group <Resource_Group_Name>
4544
```
4645

47-
Or, create an SSH key pair using `ssh-keygen`:
46+
Or, create a local SSH key pair using `ssh-keygen`:
4847

4948
```bash
5049
ssh-keygen -t rsa -b 4096
5150
```
5251

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 Azure Local 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:
52+
It's recommended that you create an SSH key pair in Azure, as you can use it later for node access or troubleshooting. 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) and [Restrict SSH Access](restrict-ssh-access.md).
53+
54+
## Download and update the Bicep scripts
55+
56+
Download these two files from the [AKSArc GitHub repo](https://github.com/Azure/aksArc/tree/main/deploymentTemplates) for your Bicep deployment: **main.bicep** and **aksarc.bicepparam**. Update the parameters from **aksarc.bicepparam** as needed, and make sure all the default values from **main.bicep** are correct.
57+
58+
The **Microsoft.HybridContainerService/provisionedClusterInstances** resource type is defined in **main.bicep**. If you want to customize more properties for cluster creation, see the [**provisionedClusterInstances** API Reference](/azure/templates/microsoft.hybridcontainerservice/provisionedclusterinstances?pivots=deployment-language-bicep).
59+
60+
## Deploy the Bicep templates
61+
62+
Create a Bicep deployment using Azure CLI:
18863

18964
```azurecli
190-
az deployment group create --name BicepDeployment --resource-group myResourceGroupName --template-file main.bicep –-parameters aksarc.bicepparam
65+
az deployment group create --name BicepDeployment --resource-group <Resource_Group_Name> --parameters aksarc.bicepparam
19166
```
19267

193-
## Validate the Bicep deployment and connect to the cluster
68+
## Validate the deployment and connect to the cluster
19469

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).
70+
You can now connect to your Kubernetes cluster by running `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).
19671

19772
## Next steps
19873

0 commit comments

Comments
 (0)