-
Notifications
You must be signed in to change notification settings - Fork 2
/
nginx-rwx.yml
97 lines (97 loc) · 1.95 KB
/
nginx-rwx.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# kubectl run --rm -ti busybox --image=nginx --restart=Never -- /bin/sh -c "curl -sS http://nginx"
apiVersion: v1
kind: PersistentVolume
metadata:
name: nginx-pv
spec:
capacity:
storage: 1Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Recycle
storageClassName: kind-shared
hostPath:
path: /devbox/nginx-pv
type: DirectoryOrCreate
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx-pvc
spec:
resources:
requests:
storage: 1Gi
volumeMode: Filesystem
storageClassName: kind-shared
accessModes:
- ReadWriteMany
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx
spec:
replicas: 5
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx
name: nginx
volumeMounts:
- name: nginx-data
mountPath: /usr/share/nginx/html
resources: {}
volumes:
- name: nginx-data
persistentVolumeClaim:
claimName: nginx-pvc
---
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx
name: nginx
spec:
ports:
- port: 80
selector:
app: nginx
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: update-nginx
spec:
jobTemplate:
metadata:
name: update-nginx
spec:
template:
metadata:
creationTimestamp: null
spec:
containers:
- image: busybox
name: update-nginx
command: ["/bin/sh","-c","echo $(date) -- update index.html ... ; date > /usr/share/nginx/html/index.html"]
volumeMounts:
- name: nginx-data
mountPath: /usr/share/nginx/html
resources: {}
volumes:
- name: nginx-data
persistentVolumeClaim:
claimName: nginx-pvc
restartPolicy: OnFailure
schedule: '* * * * *'