이 문서에서는 다양한 실험에 대한 명령줄(CLI) 및 Azure Portal 매개 변수 예제에서 실험을 만드는 예제를 제공합니다. 다음 명령을 복사하여 CLI 또는 Azure Portal에 붙여넣고 특정 리소스에 대해 편집할 수 있습니다.
다음은 Azure Portal 매개 변수를 복사하여 붙여넣을 위치의 예입니다.
아래에 표시된 "experiment.json" 예제 중 하나를 저장하려면 Cloud Shell에 nano experiment.json 입력하고, 아래 실험 예제를 복사하여 붙여넣고, 저장하고(ctrl+o), nano(ctrl+x)를 종료하고, 다음 명령을 실행하면 됩니다.
az rest --method put --uri https://management.azure.com/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment?api-version=2024-01-01
참고 항목
Azure CLI에서 실험을 만드는 데 사용하는 일반 명령입니다.
참고 항목
실험에 실험 내의 모든 리소스에서 작동할 수 있는 권한이 있는지 확인합니다. 이러한 예제에서는 시스템 할당 관리 ID만 사용하지만 사용자 할당 관리 ID도 지원합니다. 자세한 내용은 실험 권한을 참조 하세요. 이러한 실험은 대상 리소스에서 실행할 수 있는 실험 권한을 부여하지 않고 실행되지 않습니다 .
여기에서 사용 가능한 모든 역할 할당을 확인하여 대상 리소스에 필요한 권한을 결정합니다.
AKS(Azure Kubernetes Service) - 네트워크 지연
실험 설명 이 실험은 네트워크 통신을 200ms 지연
{
"identity": {
"type": "SystemAssigned",
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_network_delay_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS network latency",
"branches": [
{
"name": "AKS network latency",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT5M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"action\":\"delay\",\"mode\":\"all\",\"selector\":{\"namespaces\":[\"default\"]},\"delay\":{\"latency\":\"200ms\",\"correlation\":\"100\",\"jitter\":\"0ms\"}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:networkChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - Pod 오류
실험 설명 이 실험은 클러스터의 모든 Pod를 10분 동안 중단합니다.
{
"identity": {
"type": "SystemAssigned",
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_pod_fail_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS pod kill",
"branches": [
{
"name": "AKS pod kill",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT5M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"action\":\"pod-failure\",\"mode\":\"all\",\"duration\":\"600s\",\"selector\":{\"namespaces\":[\"autoinstrumentationdemo\"]}}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:podChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - 메모리 스트레스
실험 설명 이 실험은 4개의 AKS Pod 메모리를 10분 동안 95%로 강조합니다.
{
"identity": {
"type": "SystemAssigned",
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_memory_stress_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS memory stress",
"branches": [
{
"name": "AKS memory stress",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT10M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"mode\":\"all\",\"selector\":{\"namespaces\":[\"autoinstrumentationdemo\"]},\"stressors\":{\"memory\":{\"workers\":4,\"size\":\"95%\"}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:stressChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - CPU 스트레스
실험 설명 이 실험은 AKS 클러스터에 있는 4개의 Pod의 CPU를 95%로 강조합니다.
{
"identity": {
"type": "SystemAssigned"
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_memory_stress_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS CPU stress",
"branches": [
{
"name": "AKS CPU stress",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT10M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"mode\":\"all\",\"selector\":{\"namespaces\":[\"autoinstrumentationdemo\"]},\"stressors\":{\"cpu\":{\"workers\":4,\"load\":95}}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:stressChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - 네트워크 에뮬레이션
실험 설명 이 실험은 지정된 네임스페이스의 모든 Pod에 네트워크 에뮬레이션을 적용하여 100ms의 대기 시간과 5분 동안 0.1%의 패킷 손실을 추가합니다.
{
"identity": {
"type": "SystemAssigned"
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_network_emulation_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS network emulation",
"branches": [
{
"name": "AKS network emulation",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT5M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"action\":\"netem\",\"mode\":\"all\",\"selector\":{\"namespaces\":[\"default\"]},\"netem\":{\"latency\":\"100ms\",\"loss\":\"0.1\",\"correlation\":\"25\"}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:networkChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - 네트워크 파티션
실험 설명 이 실험은 지정된 네임스페이스의 모든 Pod에 대한 네트워크를 분할하여 5분 동안 'to' 방향으로 분할된 네트워크를 시뮬레이션합니다.
{
"identity": {
"type": "SystemAssigned"
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_partition_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS network partition",
"branches": [
{
"name": "AKS network partition",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT5M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"action\":\"partition\",\"mode\":\"all\",\"selector\":{\"namespaces\":[\"default\"]},\"partition\":{\"direction\":\"to\"}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:networkChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - 네트워크 대역폭 제한
실험 설명 이 실험은 지정된 네임스페이스의 모든 Pod에 대한 네트워크 대역폭을 1mbps로 제한하고 제한, 버퍼, 최고 속도 및 버스트에 대한 추가 매개 변수를 5분 동안 제한합니다.
{
"identity": {
"type": "SystemAssigned"
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_bandwidth_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS network bandwidth",
"branches": [
{
"name": "AKS network bandwidth",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT5M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"action\":\"bandwidth\",\"mode\":\"all\",\"selector\":{\"namespaces\":[\"default\"]},\"bandwidth\":{\"rate\":\"1mbps\",\"limit\":\"50mb\",\"buffer\":\"10kb\",\"peakrate\":\"1mbps\",\"minburst\":\"0\"}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:networkChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - 네트워크 패킷 다시 주문
실험 설명 이 실험은 지정된 네임스페이스의 모든 Pod에 대한 네트워크 패킷을 다시 정렬하며, 간격은 5개이고 순서는 5분 동안 25%입니다.
{
"identity": {
"type": "SystemAssigned"
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_reorder_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS network reorder",
"branches": [
{
"name": "AKS network reorder",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT5M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"action\":\"reorder\",\"mode\":\"all\",\"selector\":{\"namespaces\":[\"default\"]},\"reorder\":{\"gap\":\"5\",\"reorder\":\"25\",\"correlation\":\"50\"}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:networkChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - 네트워크 패킷 손실
실험 설명 이 실험은 지정된 네임스페이스의 모든 Pod에 대해 5분 동안 10%의 패킷 손실을 시뮬레이션합니다.
{
"identity": {
"type": "SystemAssigned"
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_loss_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS network loss",
"branches": [
{
"name": "AKS network loss",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT5M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"action\":\"loss\",\"mode\":\"all\",\"selector\":{\"namespaces\":[\"default\"]},\"loss\":{\"loss\":\"10\",\"correlation\":\"25\"}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:networkChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - 네트워크 패킷 중복
실험 설명 이 실험은 지정된 네임스페이스의 모든 Pod에 대해 50%의 네트워크 패킷을 5분 동안 복제합니다.
{
"identity": {
"type": "SystemAssigned"
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_duplicate_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS network duplicate",
"branches": [
{
"name": "AKS network duplicate",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT5M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"action\":\"duplicate\",\"mode\":\"all\",\"selector\":{\"namespaces\":[\"default\"]},\"duplicate\":{\"duplicate\":\"50\",\"correlation\":\"50\"}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:networkChaos/2.2"
}
]
}
]
}
]
}
}
AKS(Azure Kubernetes Service) - 네트워크 패킷 손상
실험 설명 이 실험은 지정된 네임스페이스의 모든 Pod에 대한 네트워크 패킷의 50%를 5분 동안 손상합니다.
{
"identity": {
"type": "SystemAssigned"
},
"tags": {},
"location": "westus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/aks_corrupt_experiment/providers/Microsoft.ContainerService/managedClusters/nikhilAKScluster/providers/Microsoft.Chaos/targets/Microsoft-AzureKubernetesServiceChaosMesh",
"type": "ChaosTarget"
}
],
"id": "Selector1"
}
],
"steps": [
{
"name": "AKS network corrupt",
"branches": [
{
"name": "AKS network corrupt",
"actions": [
{
"type": "continuous",
"selectorId": "Selector1",
"duration": "PT5M",
"parameters": [
{
"key": "jsonSpec",
"value": "{\"action\":\"corrupt\",\"mode\":\"all\",\"selector\":{\"namespaces\":[\"default\"]},\"corrupt\":{\"corrupt\":\"50\",\"correlation\":\"50\"}}"
}
],
"name": "urn:csci:microsoft:azureKubernetesServiceChaosMesh:networkChaos/2.2"
}
]
}
]
}
]
}
}
Azure 부하 테스트 - 부하 테스트 시작/중지(지연 포함)
실험 설명 이 실험은 기존 Azure 부하 테스트를 시작한 다음 부하 테스트를 중지하기 전에 "지연" 작업을 사용하여 10분 동안 기다립니다.
{
"identity": {
"type": "SystemAssigned",
},
"tags": {},
"location": "eastus",
"properties": {
"selectors": [
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/nikhilLoadTest/providers/microsoft.loadtestservice/loadtests/Nikhil-Demo-Load-Test/providers/Microsoft.Chaos/targets/microsoft-azureloadtest",
"type": "ChaosTarget"
}
],
"id": "66e5124c-12db-4f7e-8549-7299c5828bff"
},
{
"type": "List",
"targets": [
{
"id": "/subscriptions/123hdq8-123d-89d7-5670-123123/resourceGroups/builddemo/providers/microsoft.loadtestservice/loadtests/Nikhil-Demo-Load-Test/providers/Microsoft.Chaos/targets/microsoft-azureloadtest",
"type": "ChaosTarget"
}
],
"id": "9dc23b43-81ca-42c3-beae-3fe8ac80c30b"
}
],
"steps": [
{
"name": "Step 1 - Start Load Test",
"branches": [
{
"name": "Branch 1",
"actions": [
{
"selectorId": "66e5124c-12db-4f7e-8549-7299c5828bff",
"type": "discrete",
"parameters": [
{
"key": "testId",
"value": "ae24e6z9-d88d-4752-8552-c73e8a9adebc"
}
],
"name": "urn:csci:microsoft:azureLoadTest:start/1.0"
},
{
"type": "delay",
"duration": "PT10M",
"name": "urn:csci:microsoft:chaosStudio:TimedDelay/1.0"
}
]
}
]
},
{
"name": "Step 2 - End Load test",
"branches": [
{
"name": "Branch 1",
"actions": [
{
"selectorId": "9dc23b43-81ca-42c3-beae-3fe8ac80c30b",
"type": "discrete",
"parameters": [
{
"key": "testId",
"value": "ae24e6z9-d88d-4752-8552-c73e8a9adebc"
}
],
"name": "urn:csci:microsoft:azureLoadTest:stop/1.0"
}
]
}
]
}
]
}
}
}