Skip to content

Commit a16bd90

Browse files
committed
Kubernetes: Add liveness & persistvolumes manifest files
Signed-off-by: NotHarshhaa <[email protected]>
1 parent 581f975 commit a16bd90

File tree

4 files changed

+135
-0
lines changed

4 files changed

+135
-0
lines changed

Diff for: liveness/liveness.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
labels:
5+
test: liveness
6+
name: liveness-http
7+
spec:
8+
containers:
9+
- name: liveness
10+
image: k8s.gcr.io/liveness
11+
args:
12+
- /server
13+
livenessProbe:
14+
httpGet:
15+
path: /healthz
16+
port: 8080
17+
httpHeaders:
18+
- name: Custom-Header
19+
value: Awesome
20+
initialDelaySeconds: 3
21+
periodSeconds: 3
22+
---
23+
apiVersion: v1
24+
kind: Pod
25+
metadata:
26+
labels:
27+
test: liveness
28+
name: liveness-exec
29+
spec:
30+
containers:
31+
- name: liveness
32+
image: k8s.gcr.io/busybox
33+
args:
34+
- /bin/sh
35+
- -c
36+
- touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600
37+
livenessProbe:
38+
exec:
39+
command:
40+
- cat
41+
- /tmp/healthy
42+
initialDelaySeconds: 5
43+
periodSeconds: 5
44+
---
45+
apiVersion: v1
46+
kind: Pod
47+
metadata:
48+
name: goproxy
49+
labels:
50+
app: goproxy
51+
spec:
52+
containers:
53+
- name: goproxy
54+
image: k8s.gcr.io/goproxy:0.1
55+
ports:
56+
- containerPort: 8080
57+
livenessProbe:
58+
tcpSocket:
59+
port: 8080
60+
initialDelaySeconds: 15
61+
periodSeconds: 20

Diff for: persistentvolume/deploy.yaml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: mysqlsecret
5+
type: Opaque
6+
stringData:
7+
password: P@ssw0rd!
8+
---
9+
apiVersion: apps/v1
10+
kind: Deployment
11+
metadata:
12+
name: mysqldeployment
13+
labels:
14+
app: mysql
15+
spec:
16+
replicas: 1
17+
selector:
18+
matchLabels:
19+
app: mysql
20+
strategy:
21+
type: Recreate
22+
template:
23+
metadata:
24+
labels:
25+
app: mysql
26+
spec:
27+
containers:
28+
- name: mysql
29+
image: mysql
30+
ports:
31+
- containerPort: 3306
32+
volumeMounts:
33+
- mountPath: "/var/lib/mysql"
34+
name: mysqlvolume
35+
env:
36+
- name: MYSQL_ROOT_PASSWORD
37+
valueFrom:
38+
secretKeyRef:
39+
name: mysqlsecret
40+
key: password
41+
volumes:
42+
- name: mysqlvolume
43+
persistentVolumeClaim:
44+
claimName: mysqlclaim

Diff for: persistentvolume/pv.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: PersistentVolume
3+
metadata:
4+
name: mysqlpv
5+
labels:
6+
app: mysql
7+
spec:
8+
capacity:
9+
storage: 5Gi
10+
accessModes:
11+
- ReadWriteOnce
12+
persistentVolumeReclaimPolicy: Recycle
13+
nfs:
14+
path: /
15+
server: 10.255.255.10

Diff for: persistentvolume/pvc.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: mysqlclaim
5+
spec:
6+
accessModes:
7+
- ReadWriteOnce
8+
volumeMode: Filesystem
9+
resources:
10+
requests:
11+
storage: 5Gi
12+
storageClassName: ""
13+
selector:
14+
matchLabels:
15+
app: mysql

0 commit comments

Comments
 (0)