Skip to content

Commit 607d68a

Browse files
tomkukraljwerak
authored andcommitted
add README and reference
1 parent 2191cd7 commit 607d68a

File tree

4 files changed

+158
-35
lines changed

4 files changed

+158
-35
lines changed

trouble/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
This repository containers common Kubernetes problems. Each YAML file (or directory) contains broken deployment.
2+
3+
* `clean.sh` will clean everything in `default` namespaces and fix broken nodes.
4+
5+
6+
# Easy
7+
8+
* U01 - Scaled to 0 replicas
9+
* U02 - Wrong service selector (application instead of app)
10+
* U03 - Typo in container image
11+
* U09 - Nodes unschedulable
12+
13+
# Medium
14+
15+
* U04 - ConfigMap missing
16+
* U05 - Persistent volume claim missing
17+
* U06 - Missing node label (nodeSelector)
18+
* U08 - Service port mismatch
19+
* U09 - Nodes unschedulable
20+
* U10 - Nodes tainted
21+
* U11 - InitContainer failing
22+
* U12 - Liveness probe not working (port mismatch)

trouble/reference.yml

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: kad
6+
spec:
7+
selector:
8+
app: kad
9+
ports:
10+
- protocol: TCP
11+
targetPort: 5000
12+
port: 80
13+
---
14+
apiVersion: v1
15+
kind: Service
16+
metadata:
17+
name: redis
18+
spec:
19+
type: ClusterIP
20+
clusterIP: None
21+
selector:
22+
app: redis
23+
ports:
24+
- protocol: TCP
25+
port: 6379
26+
---
27+
apiVersion: v1
28+
kind: ConfigMap
29+
metadata:
30+
name: kad
31+
data:
32+
config.yml: |
33+
abc: 123
34+
password: LinuxDays
35+
option.color: red
36+
---
37+
apiVersion: v1
38+
kind: Secret
39+
metadata:
40+
name: credentials
41+
type: Opaque
42+
data:
43+
username: YWRtaW4=
44+
password: TGludXhEYXlz
45+
---
46+
apiVersion: extensions/v1beta1
47+
kind: Deployment
48+
metadata:
49+
name: kad
50+
spec:
51+
replicas: 1
52+
template:
53+
metadata:
54+
labels:
55+
app: kad
56+
spec:
57+
containers:
58+
- name: app
59+
image: tomkukral/kad
60+
imagePullPolicy: Always
61+
ports:
62+
- containerPort: 5000
63+
command: ["/bin/kad", "--color", "$(COLOR)", "--user", "$(USERNAME)"]
64+
env:
65+
# static configuration from yaml
66+
- name: REDIS_SERVER
67+
value: redis-0.redis:6379
68+
# configuraiton from downward API
69+
- name: NODE_NAME
70+
valueFrom:
71+
fieldRef:
72+
fieldPath: spec.nodeName
73+
# variable form configmap
74+
- name: COLOR
75+
valueFrom:
76+
configMapKeyRef:
77+
name: kad
78+
key: option.color
79+
# variables from secret
80+
- name: USERNAME
81+
valueFrom:
82+
secretKeyRef:
83+
name: credentials
84+
key: username
85+
- name: PASSWORD
86+
valueFrom:
87+
secretKeyRef:
88+
name: credentials
89+
key: password
90+
volumeMounts:
91+
- name: config
92+
mountPath: /etc/kad/
93+
volumes:
94+
- name: config
95+
configMap:
96+
name: kad
97+
items:
98+
- key: config.yml
99+
path: config.yml
100+
---
101+
apiVersion: apps/v1
102+
kind: StatefulSet
103+
metadata:
104+
name: redis
105+
spec:
106+
selector:
107+
matchLabels:
108+
app: redis
109+
serviceName: redis
110+
replicas: 1
111+
template:
112+
metadata:
113+
labels:
114+
app: redis
115+
annotations:
116+
sidecar.istio.io/inject: "true"
117+
spec:
118+
containers:
119+
- name: redis
120+
image: redis
121+
resources:
122+
limits:
123+
memory: 128Mi
124+
ports:
125+
- containerPort: 6379
126+
volumeMounts:
127+
- mountPath: "/data"
128+
name: redis-disk
129+
volumeClaimTemplates:
130+
- metadata:
131+
name: redis-disk
132+
spec:
133+
accessModes: ["ReadWriteOnce"]
134+
resources:
135+
requests:
136+
storage: 1Gi

trouble/reference.yml.asc

-35
This file was deleted.

trouble/solutions.asc

-690 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)