-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path26-chaos-studio.sh
62 lines (47 loc) · 2.89 KB
/
26-chaos-studio.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#
# Requirements:
# - Local accounts are required
# - Experiment needs to have access API server
#
# az aks create ...
# --disable-local-accounts \ <- DO NOT USE THIS
# --api-server-authorized-ip-ranges $my_ip \ <- DO NOT USE THIS
#
# Install
helm repo add chaos-mesh https://charts.chaos-mesh.org
helm repo update
kubectl create ns chaos-testing
helm install chaos-mesh chaos-mesh/chaos-mesh --namespace=chaos-testing --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock
kubectl get pods -n chaos-testing
# DNS Chaos:
# https://chaos-mesh.org/docs/simulate-dns-chaos-on-kubernetes/#configuration-description
# {"action":"error","mode":"all","patterns":["bing.com","chaos-mesh.*","github.?om","login.microsoftonline.com","network-app-internal-svc.*","network-app-clusterip-svc.*"],"selector":{"namespaces":["network-app","network-app2","update-app"]}}
curl -X POST --data "IPLOOKUP github.com" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "IPLOOKUP bing.com" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "IPLOOKUP login.microsoftonline.com" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "IPLOOKUP microsoft.com" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "IPLOOKUP network-app-internal-svc" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "IPLOOKUP network-app-internal-svc.network-app.svc.cluster.local" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "IPLOOKUP network-app-clusterip-svc" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "IPLOOKUP network-app-clusterip-svc.network-app.svc.cluster.local" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "IPLOOKUP update-app-svc.update-app.svc.cluster.local" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "HTTP GET https://login.microsoftonline.com" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "HTTP GET http://network-app-internal-svc" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "HTTP GET http://network-app-clusterip-svc" "$network_app_external_svc_ip/api/commands"
curl -X POST --data "HTTP GET https://microsoft.com" "$network_app_external_svc_ip/api/commands"
# Pod Chaos:
# https://chaos-mesh.org/docs/simulate-pod-chaos-on-kubernetes/#field-description
# {"action":"pod-failure","mode":"fixed","value":"2","duration":"300s","selector":{"namespaces":["network-app"]}}
# {"action":"pod-failure","mode":"fixed-percent","value":"66","duration":"300s","selector":{"namespaces":["update-app"]}}
kubectl get pods -n network-app
list_pods network-app
kubectl get pods -n update-app
curl $network_app_external_svc_ip
curl -s $update_app_svc_ip/api/update | jq .
while true; do
curl -s $update_app_svc_ip/api/update | jq .
done
# Availability zone chaos:
kubectl get nodes
kubectl get pods -n update-app
list_pods update-app