Skip to content

Commit f3a48a5

Browse files
Merge pull request #229425 from themar-msft/themar-vnet-2-subnets
Updates chaos vnet doc to use two subnets
2 parents 1a9b297 + c6d3813 commit f3a48a5

File tree

1 file changed

+50
-12
lines changed

1 file changed

+50
-12
lines changed

articles/chaos-studio/chaos-studio-private-networking.md

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ ms.author: prashabora
99
ms.service: chaos-studio
1010
---
1111
# VNet Injection in Chaos Studio
12+
1213
VNet is the fundamental building block for your private network in Azure. VNet enables many Azure resources to securely communicate with each other, the internet, and on-premises networks. VNet is like a traditional network you would operate in your own data center. However, VNet also has the benefits of Azure infrastructure, scale, availability, and isolation.
1314

1415
## How VNet Injection works in Chaos Studio
15-
VNet injection allows Chaos resource provider to inject containerized workloads into your VNet. This means that resources without public endpoints can be accessed via a private IP address on the VNet. Below are the steps you can follow for vnet injection:
16+
17+
VNet injection allows a Chaos resource provider to inject containerized workloads into your VNet so that resources without public endpoints can be accessed via a private IP address on the VNet. To configure VNet injection:
1618

1719
1. Register the `Microsoft.ContainerInstance` resource provider with your subscription (if applicable).
1820

@@ -26,13 +28,31 @@ VNet injection allows Chaos resource provider to inject containerized workloads
2628
az provider show --namespace 'Microsoft.ContainerInstance' | grep registrationState
2729
```
2830

29-
You should see output similar to the following:
31+
In the output, you should see something similar to:
3032

3133
```bash
3234
"registrationState": "Registered",
3335
```
3436

35-
2. Re-register the `Microsoft.Chaos` resource provider with your subscription.
37+
1. Register the `Microsoft.Relay` resource provider with your subscription.
38+
39+
```bash
40+
az provider register --namespace 'Microsoft.Relay' --wait
41+
```
42+
43+
Verify the registration by running the following command:
44+
45+
```bash
46+
az provider show --namespace 'Microsoft.Relay' | grep registrationState
47+
```
48+
49+
In the output, you should see something similar to:
50+
51+
```bash
52+
"registrationState": "Registered",
53+
```
54+
55+
1. Re-register the `Microsoft.Chaos` resource provider with your subscription.
3656

3757
```bash
3858
az provider register --namespace 'Microsoft.Chaos' --wait
@@ -44,34 +64,52 @@ VNet injection allows Chaos resource provider to inject containerized workloads
4464
az provider show --namespace 'Microsoft.Chaos' | grep registrationState
4565
```
4666

47-
You should see output similar to the following:
67+
In the output, you should see something similar to:
4868

4969
```bash
5070
"registrationState": "Registered",
5171
```
5272

53-
3. Create a subnet named `ChaosStudioSubnet` in the VNet you want to inject into. And delegate the subnet to `Microsoft.ContainerInstance/containerGroups` service.
73+
1. Create two subnets in the VNet you want to inject into:
74+
75+
- `ChaosStudioContainerSubnet`
76+
- Delegate the subnet to `Microsoft.ContainerInstance/containerGroups` service.
77+
- This subnet must have at least /28 in address space
78+
- `ChaosStudioRelaySubnet`
79+
- This subnet must have at least /28 in address space
5480

55-
4. Set the `properties.subnetId` property when you create or update the Target resource. The value should be the resource ID of the subnet created in step 3.
81+
1. Set the `properties.subnets.containerSubnetId` and `properties.subnets.relaySubnetId` properties when you create or update the Target resource. The value should be the resource ID of the subnet created in step 3.
5682

5783
Replace `$SUBSCRIPTION_ID` with your Azure subscription ID, `$RESOURCE_GROUP` and `$AKS_CLUSTER` with the resource group name and your AKS cluster resource name. Also, replace `$AKS_INFRA_RESOURCE_GROUP` and `$AKS_VNET` with your AKS's infrastructure resource group name and VNet name.
5884
5985
```bash
60-
URL=https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.ContainerService/managedClusters/$AKS_CLUSTER/providers/Microsoft.Chaos/targets/microsoft-azurekubernetesservicechaosmesh?api-version=2022-10-01-preview
61-
SUBNET_ID=/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$AKS_INFRA_RESOURCE_GROUP/providers/Microsoft.Network/virtualNetworks/$AKS_VNET/subnets/ChaosStudioSubnet
62-
BODY="{ \"properties\": { \"subnetId\": \"$SUBNET_ID\" } }"
86+
CONTAINER_SUBNET_ID=/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$AKS_INFRA_RESOURCE_GROUP/providers/Microsoft.Network/virtualNetworks/$AKS_VNET/subnets/ChaosStudioContainerSubnet
87+
RELAY_SUBNET_ID=/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$AKS_INFRA_RESOURCE_GROUP/providers/Microsoft.Network/virtualNetworks/$AKS_VNET/subnets/ChaosStudioRelaySubnet
88+
BODY="{ \"properties\": { \"subnets\": { \"containerSubnetId\": \"$CONTAINER_SUBNET_ID\", \"relaySubnetId\": \"$RELAY_SUBNET_ID\" } } }"
6389
az rest --method put --url $URL --body "$BODY"
6490
```
6591
66-
5. Start the experiment.
92+
1. Start the experiment.
6793
6894
## Limitations
69-
* At present the VNet injection will only be possible in subscriptions/regions where Azure Container Instances and Azure Relay are available. They are deployed to target regions.
70-
* When you create a Target resource that you would like to enable with VNet injection, you will need Microsoft.Network/virtualNetworks/subnets/write access to the virtual network. For example, if the AKS cluster is deployed to VNet_A, then you must have permissions to create subnets in VNet_A in order to enable VNet injection for the AKS cluster. You will have to specify a subnet (in VNet_A) that the container will be deployed to.
95+
* VNet injection is currently only possible in subscriptions/regions where Azure Container Instances and Azure Relay are available. They're deployed to target regions.
96+
* When you create a Target resource that you'll enable with VNet injection, you need Microsoft.Network/virtualNetworks/subnets/write access to the virtual network. For example, if the AKS cluster is deployed to VNet_A, then you must have permissions to create subnets in VNet_A in order to enable VNet injection for the AKS cluster. You have to specify a subnet (in VNet_A) that the container will be deployed to.
7197
7298
Request Body when created Target resource with VNet injection enabled:
7399
100+
```json
101+
{
102+
"properties": {
103+
"subnets": {
104+
"containerSubnetId": "/subscriptions/.../subnets/ChaosStudioContainerSubnet",
105+
"relaySubnetId": "/subscriptions/.../subnets/ChaosStudioRelaySubnet"
106+
}
107+
}
108+
}
109+
```
110+
<!--
74111
![Target resource with VNet Injection](images/chaos-studio-rp-vnet-injection.png)
112+
-->
75113
76114
## Next steps
77115
Now that you understand how VNet Injection can be achieved for Chaos Studio, you're ready to:

0 commit comments

Comments
 (0)