1
- name : Deploy Kubernetes Troubleshooting Scenarios
1
+ name : Deploy Interview App
2
2
3
3
on :
4
4
workflow_dispatch :
10
10
11
11
env :
12
12
IMAGE_NAME : becloudready/k8s-troubleshooting-scenarios
13
- IMAGE_TAG : 2 .0.0
13
+ IMAGE_TAG : 7 .0.0
14
14
15
15
jobs :
16
16
deploy :
@@ -34,145 +34,70 @@ jobs:
34
34
run : |
35
35
kubectl create namespace ${{ inputs.namespace }} --dry-run=client -o yaml | kubectl apply -f -
36
36
37
- - name : Deploy OOM Killer Scenario
37
+ - name : Apply ConfigMap
38
38
run : |
39
39
cat <<EOF | kubectl apply -n ${{ inputs.namespace }} -f -
40
- apiVersion: apps/ v1
41
- kind: Deployment
40
+ apiVersion: v1
41
+ kind: ConfigMap
42
42
metadata:
43
- name: oom-deployment
44
- spec:
45
- replicas: 1
46
- selector:
47
- matchLabels:
48
- app: oom-app
49
- template:
50
- metadata:
51
- labels:
52
- app: oom-app
53
- spec:
54
- containers:
55
- - name: oom-container
56
- image: becloudready/k8s-troubleshooting-scenarios:2.0.0
57
- env:
58
- - name: FAILURE_MODE
59
- value: "oom"
60
- resources:
61
- limits:
62
- memory: "128Mi"
43
+ name: app-config
44
+ data:
45
+ config.yml: |
46
+ database:
47
+ host: db-service
48
+ port: 5432
49
+ logging:
50
+ level: debug
63
51
EOF
64
52
65
- - name : Deploy Missing File Scenario
53
+ - name : Deploy Interview App
66
54
run : |
67
55
cat <<EOF | kubectl apply -n ${{ inputs.namespace }} -f -
68
56
apiVersion: apps/v1
69
57
kind: Deployment
70
58
metadata:
71
- name: missing-file-deployment
59
+ name: interview-app
72
60
spec:
73
61
replicas: 1
74
62
selector:
75
63
matchLabels:
76
- app: missing-file-app
64
+ app: interview
77
65
template:
78
66
metadata:
79
67
labels:
80
- app: missing-file-app
68
+ app: interview
81
69
spec:
70
+ dnsPolicy: "Default"
71
+ dnsConfig:
72
+ nameservers:
73
+ - "203.0.113.123"
74
+ searches:
75
+ - google.com
76
+ options:
77
+ - name: ndots
78
+ value: "1"
82
79
containers:
83
- - name: missing-file-container
84
- image: becloudready/k8s-troubleshooting-scenarios:2.0.0
85
- env:
86
- - name: FAILURE_MODE
87
- value: "missing_file"
88
- EOF
89
-
90
- - name : Deploy DNS Issues Scenario
91
- run : |
92
- cat <<EOF | kubectl apply -n ${{ inputs.namespace }} -f -
93
- apiVersion: apps/v1
94
- kind: Deployment
95
- metadata:
96
- name: dns-issues-deployment
97
- spec:
98
- replicas: 1
99
- selector:
100
- matchLabels:
101
- app: dns-issues-app
102
- template:
103
- metadata:
104
- labels:
105
- app: dns-issues-app
106
- spec:
107
- dnsPolicy: Default
108
- containers:
109
- - name: dns-issues-container
110
- image: becloudready/k8s-troubleshooting-scenarios:2.0.0
111
- env:
112
- - name: FAILURE_MODE
113
- value: "dns"
114
- EOF
115
-
116
- - name : Deploy Taints and Tolerations Example
117
- run : |
118
- cat <<EOF | kubectl apply -n ${{ inputs.namespace }} -f -
119
- apiVersion: apps/v1
120
- kind: Deployment
121
- metadata:
122
- name: tolerations-deployment
123
- spec:
124
- replicas: 1
125
- selector:
126
- matchLabels:
127
- app: tolerations-app
128
- template:
129
- metadata:
130
- labels:
131
- app: tolerations-app
132
- spec:
133
- tolerations:
134
- - key: "dedicated"
135
- operator: "Equal"
136
- value: "gpu"
137
- effect: "NoSchedule"
138
- containers:
139
- - name: tolerations-container
140
- image: becloudready/k8s-troubleshooting-scenarios:2.0.0
80
+ - name: main
81
+ image: \${{ env.IMAGE_NAME }}:\${{ env.IMAGE_TAG }}
82
+ command: ["python3", "/app/troubleshoot_scenarios.py"]
83
+ volumeMounts:
84
+ - name: config-vol
85
+ mountPath: /etc/app
86
+ resources:
87
+ limits:
88
+ memory: "256Mi"
89
+ cpu: "500m"
90
+ volumes:
91
+ - name: config-vol
92
+ configMap:
93
+ name: app-config
94
+ items:
95
+ - key: config1.yml
96
+ path: config.yaml
141
97
EOF
142
98
143
- - name : Deploy Affinity/Anti-affinity Example
99
+ - name : Verify Deployment
144
100
run : |
145
- cat <<EOF | kubectl apply -n ${{ inputs.namespace }} -f -
146
- apiVersion: apps/v1
147
- kind: Deployment
148
- metadata:
149
- name: affinity-deployment
150
- spec:
151
- replicas: 3
152
- selector:
153
- matchLabels:
154
- app: affinity-app
155
- template:
156
- metadata:
157
- labels:
158
- app: affinity-app
159
- spec:
160
- affinity:
161
- podAntiAffinity:
162
- requiredDuringSchedulingIgnoredDuringExecution:
163
- - labelSelector:
164
- matchExpressions:
165
- - key: app
166
- operator: In
167
- values:
168
- - affinity-app
169
- topologyKey: "kubernetes.io/hostname"
170
- containers:
171
- - name: affinity-container
172
- image: becloudready/k8s-troubleshooting-scenarios:2.0.0
173
- EOF
101
+ kubectl get pods -n ${{ inputs.namespace }}
174
102
175
- - name : Verify deployments
176
- run : |
177
- kubectl get deployments -n ${{ inputs.namespace }}
178
103
0 commit comments