Skip to content

Commit d610fe3

Browse files
committed
infra playground
1 parent 6d6c1b2 commit d610fe3

File tree

13 files changed

+971
-0
lines changed

13 files changed

+971
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## ChaosMesh Playground
2+
3+
This deployment is used to debug various [ChaosMesh](https://chaos-mesh.org/) with [Kind](https://kind.sigs.k8s.io/)
4+
5+
Install [DevBox](https://www.jetify.com/devbox) and run your environment
6+
```
7+
devbox run up
8+
```
9+
10+
Overview the services
11+
```
12+
devbox shell
13+
k9s
14+
```
15+
Apply experiments (inside devbox shell)
16+
```
17+
kubectl apply -f manifests/latency.yaml
18+
```
19+
Debug `ChaosMesh` using k9s, check daemon logs.
20+
21+
Remove the environment
22+
```
23+
devbox run down
24+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.5/.schema/devbox.schema.json",
3+
"packages": [
4+
5+
6+
7+
8+
],
9+
"shell": {
10+
"init_hook": [
11+
"echo 'Welcome to devbox!' > /dev/null"
12+
],
13+
"scripts": {
14+
"up": [
15+
"kind create cluster --name cm-playground --config kind.yaml",
16+
"helm repo add chaos-mesh https://charts.chaos-mesh.org",
17+
"helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-mesh --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock --version 2.7.0",
18+
"kubectl apply -f dummy.yaml"
19+
],
20+
"down": [
21+
"kind delete cluster --name cm-playground"
22+
],
23+
"context": [
24+
"kubectl config set-context"
25+
]
26+
}
27+
}
28+
}
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {
4+
5+
"last_modified": "2025-01-19T08:16:51Z",
6+
"resolved": "github:NixOS/nixpkgs/50165c4f7eb48ce82bd063e1fb8047a0f515f8ce#k9s",
7+
"source": "devbox-search",
8+
"version": "0.32.7",
9+
"systems": {
10+
"aarch64-darwin": {
11+
"outputs": [
12+
{
13+
"name": "out",
14+
"path": "/nix/store/davyazrjq67v3asr3c166xwh2q4q2wmj-k9s-0.32.7",
15+
"default": true
16+
}
17+
],
18+
"store_path": "/nix/store/davyazrjq67v3asr3c166xwh2q4q2wmj-k9s-0.32.7"
19+
},
20+
"aarch64-linux": {
21+
"outputs": [
22+
{
23+
"name": "out",
24+
"path": "/nix/store/jkibg8q4phcw1yj8lx5f5avshzbjjr8f-k9s-0.32.7",
25+
"default": true
26+
}
27+
],
28+
"store_path": "/nix/store/jkibg8q4phcw1yj8lx5f5avshzbjjr8f-k9s-0.32.7"
29+
},
30+
"x86_64-darwin": {
31+
"outputs": [
32+
{
33+
"name": "out",
34+
"path": "/nix/store/3j6m04knddvzgcq3xp0vr1551s6ii93s-k9s-0.32.7",
35+
"default": true
36+
}
37+
],
38+
"store_path": "/nix/store/3j6m04knddvzgcq3xp0vr1551s6ii93s-k9s-0.32.7"
39+
},
40+
"x86_64-linux": {
41+
"outputs": [
42+
{
43+
"name": "out",
44+
"path": "/nix/store/m8d3pcdzrcfvy3rzkjpgfr0v94a1pf4i-k9s-0.32.7",
45+
"default": true
46+
}
47+
],
48+
"store_path": "/nix/store/m8d3pcdzrcfvy3rzkjpgfr0v94a1pf4i-k9s-0.32.7"
49+
}
50+
}
51+
},
52+
53+
"last_modified": "2025-01-19T08:16:51Z",
54+
"resolved": "github:NixOS/nixpkgs/50165c4f7eb48ce82bd063e1fb8047a0f515f8ce#kind",
55+
"source": "devbox-search",
56+
"version": "0.26.0",
57+
"systems": {
58+
"aarch64-darwin": {
59+
"outputs": [
60+
{
61+
"name": "out",
62+
"path": "/nix/store/4j12j5zijvbcyafx85a2qh8jkv4m6lnz-kind-0.26.0",
63+
"default": true
64+
}
65+
],
66+
"store_path": "/nix/store/4j12j5zijvbcyafx85a2qh8jkv4m6lnz-kind-0.26.0"
67+
},
68+
"aarch64-linux": {
69+
"outputs": [
70+
{
71+
"name": "out",
72+
"path": "/nix/store/gkpan5sh4kmbxknrf79p9ssd1j024ydb-kind-0.26.0",
73+
"default": true
74+
}
75+
],
76+
"store_path": "/nix/store/gkpan5sh4kmbxknrf79p9ssd1j024ydb-kind-0.26.0"
77+
},
78+
"x86_64-darwin": {
79+
"outputs": [
80+
{
81+
"name": "out",
82+
"path": "/nix/store/2vsw8jyi2n4sm74sk1kbff6hq5v8nz6i-kind-0.26.0",
83+
"default": true
84+
}
85+
],
86+
"store_path": "/nix/store/2vsw8jyi2n4sm74sk1kbff6hq5v8nz6i-kind-0.26.0"
87+
},
88+
"x86_64-linux": {
89+
"outputs": [
90+
{
91+
"name": "out",
92+
"path": "/nix/store/hp80rb9dpsk2wj5db2zngh5b8hrgwy4k-kind-0.26.0",
93+
"default": true
94+
}
95+
],
96+
"store_path": "/nix/store/hp80rb9dpsk2wj5db2zngh5b8hrgwy4k-kind-0.26.0"
97+
}
98+
}
99+
},
100+
101+
"last_modified": "2025-01-22T06:06:04Z",
102+
"resolved": "github:NixOS/nixpkgs/5757bbb8bd7c0630a0cc4bb19c47e588db30b97c#kubectl",
103+
"source": "devbox-search",
104+
"version": "1.32.1",
105+
"systems": {
106+
"aarch64-darwin": {
107+
"outputs": [
108+
{
109+
"name": "out",
110+
"path": "/nix/store/18441nqn0dahiwn1rvwilqvrqwqvvknz-kubectl-1.32.1",
111+
"default": true
112+
},
113+
{
114+
"name": "man",
115+
"path": "/nix/store/7aqhrqy27487ph8gcqwl92lpn48zczlm-kubectl-1.32.1-man",
116+
"default": true
117+
},
118+
{
119+
"name": "convert",
120+
"path": "/nix/store/4ahm5rn4f326izlh8nh6zfcf066r0jp9-kubectl-1.32.1-convert"
121+
}
122+
],
123+
"store_path": "/nix/store/18441nqn0dahiwn1rvwilqvrqwqvvknz-kubectl-1.32.1"
124+
},
125+
"aarch64-linux": {
126+
"outputs": [
127+
{
128+
"name": "out",
129+
"path": "/nix/store/jylypnz6nddbqf85glbyhpmjsbgmlayj-kubectl-1.32.1",
130+
"default": true
131+
},
132+
{
133+
"name": "man",
134+
"path": "/nix/store/0f95qz0ynbilx8h0z350in0d8kc9aj1m-kubectl-1.32.1-man",
135+
"default": true
136+
},
137+
{
138+
"name": "convert",
139+
"path": "/nix/store/y9kx67c1h6sjr3l4vp7j200v640h32kr-kubectl-1.32.1-convert"
140+
}
141+
],
142+
"store_path": "/nix/store/jylypnz6nddbqf85glbyhpmjsbgmlayj-kubectl-1.32.1"
143+
},
144+
"x86_64-darwin": {
145+
"outputs": [
146+
{
147+
"name": "out",
148+
"path": "/nix/store/c4ha370mr37kzmr5d3k3x2f7ln51r9fz-kubectl-1.32.1",
149+
"default": true
150+
},
151+
{
152+
"name": "man",
153+
"path": "/nix/store/5p29mlkb5ywfn2znwb3pxbyr187585yy-kubectl-1.32.1-man",
154+
"default": true
155+
},
156+
{
157+
"name": "convert",
158+
"path": "/nix/store/83qij5g1wkrrwzjn1cwnkd342ifzw97x-kubectl-1.32.1-convert"
159+
}
160+
],
161+
"store_path": "/nix/store/c4ha370mr37kzmr5d3k3x2f7ln51r9fz-kubectl-1.32.1"
162+
},
163+
"x86_64-linux": {
164+
"outputs": [
165+
{
166+
"name": "out",
167+
"path": "/nix/store/v312kkwzk8mibc9z67n53hab6mcc7cn5-kubectl-1.32.1",
168+
"default": true
169+
},
170+
{
171+
"name": "man",
172+
"path": "/nix/store/jb9zc5f93z67xaldz5zmmnv8d5pzc94r-kubectl-1.32.1-man",
173+
"default": true
174+
},
175+
{
176+
"name": "convert",
177+
"path": "/nix/store/1lkaw0m4238bichjjl5jkkpqpvxahp43-kubectl-1.32.1-convert"
178+
}
179+
],
180+
"store_path": "/nix/store/v312kkwzk8mibc9z67n53hab6mcc7cn5-kubectl-1.32.1"
181+
}
182+
}
183+
},
184+
185+
"last_modified": "2025-01-22T06:06:04Z",
186+
"resolved": "github:NixOS/nixpkgs/5757bbb8bd7c0630a0cc4bb19c47e588db30b97c#kubernetes-helm",
187+
"source": "devbox-search",
188+
"version": "3.17.0",
189+
"systems": {
190+
"aarch64-darwin": {
191+
"outputs": [
192+
{
193+
"name": "out",
194+
"path": "/nix/store/kqb20496bhsi6wlggidm645ncch8lzxw-kubernetes-helm-3.17.0",
195+
"default": true
196+
}
197+
],
198+
"store_path": "/nix/store/kqb20496bhsi6wlggidm645ncch8lzxw-kubernetes-helm-3.17.0"
199+
},
200+
"aarch64-linux": {
201+
"outputs": [
202+
{
203+
"name": "out",
204+
"path": "/nix/store/d60427zv4gsskq2rsq6yfbzzwgr4xdz7-kubernetes-helm-3.17.0",
205+
"default": true
206+
}
207+
],
208+
"store_path": "/nix/store/d60427zv4gsskq2rsq6yfbzzwgr4xdz7-kubernetes-helm-3.17.0"
209+
},
210+
"x86_64-darwin": {
211+
"outputs": [
212+
{
213+
"name": "out",
214+
"path": "/nix/store/zak1xp04pcfm0b9gaap9jxp4bq0lawxq-kubernetes-helm-3.17.0",
215+
"default": true
216+
}
217+
],
218+
"store_path": "/nix/store/zak1xp04pcfm0b9gaap9jxp4bq0lawxq-kubernetes-helm-3.17.0"
219+
},
220+
"x86_64-linux": {
221+
"outputs": [
222+
{
223+
"name": "out",
224+
"path": "/nix/store/zidsngzm5lwyabaq9fy6m9h6sifk6pg8-kubernetes-helm-3.17.0",
225+
"default": true
226+
}
227+
],
228+
"store_path": "/nix/store/zidsngzm5lwyabaq9fy6m9h6sifk6pg8-kubernetes-helm-3.17.0"
229+
}
230+
}
231+
}
232+
}
233+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: ping-deployment
5+
spec:
6+
replicas: 4
7+
selector:
8+
matchLabels:
9+
app: ping-app
10+
template:
11+
metadata:
12+
labels:
13+
app: ping-app
14+
spec:
15+
containers:
16+
- name: ping-container
17+
image: alpine:latest
18+
command: ["sh", "-c", "while true; do ping -c 1 google.com; sleep 1; done"]
19+
20+
---
21+
apiVersion: v1
22+
kind: Service
23+
metadata:
24+
name: ping-service-1
25+
spec:
26+
selector:
27+
app: ping-app
28+
ports:
29+
- protocol: TCP
30+
port: 80
31+
targetPort: 80
32+
33+
---
34+
apiVersion: v1
35+
kind: Service
36+
metadata:
37+
name: ping-service-2
38+
spec:
39+
selector:
40+
app: ping-app
41+
ports:
42+
- protocol: TCP
43+
port: 80
44+
targetPort: 80
45+
46+
---
47+
apiVersion: v1
48+
kind: Service
49+
metadata:
50+
name: ping-service-3
51+
spec:
52+
selector:
53+
app: ping-app
54+
ports:
55+
- protocol: TCP
56+
port: 80
57+
targetPort: 80
58+
59+
---
60+
apiVersion: v1
61+
kind: Service
62+
metadata:
63+
name: ping-service-4
64+
spec:
65+
selector:
66+
app: ping-app
67+
ports:
68+
- protocol: TCP
69+
port: 80
70+
targetPort: 80
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
kind: Cluster
2+
apiVersion: kind.x-k8s.io/v1alpha4
3+
nodes:
4+
- role: control-plane
5+
image: kindest/node:v1.27.3
6+
- role: worker
7+
image: kindest/node:v1.27.3
8+
- role: worker
9+
image: kindest/node:v1.27.3
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: chaos-mesh.org/v1alpha1
2+
kind: NetworkChaos
3+
metadata:
4+
name: introduce-latency-to-google
5+
namespace: default
6+
spec:
7+
action: delay
8+
mode: all
9+
selector:
10+
labelSelectors:
11+
app: ping-app
12+
delay:
13+
latency: "100ms"
14+
correlation: "100"
15+
jitter: "0ms"

0 commit comments

Comments
 (0)