forked from joshua143/k8s-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ginx-statefulset.yml.txt
67 lines (67 loc) · 1.2 KB
/
ginx-statefulset.yml.txt
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
---
kind: PersistentVolume
apiVersion: v1
metadata:
name: my-pv
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes: ["ReadWriteOnce", "ReadWriteMany"]
hostPath:
path: "/tmp/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: my-pvc
spec:
storageClassName: manual
resources:
requests:
storage: 1Gi
accessModes: ["ReadWriteOnce", "ReadWriteMany"]
---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
ports:
- port: 80
name: web
clusterIP: None
selector:
app: nginx
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
selector:
matchLabels:
app: nginx
serviceName: "nginx"
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
terminationGracePeriodSeconds: 10
containers:
- name: nginx
image: k8s.gcr.io/nginx-slim:0.8
ports:
- containerPort: 80
name: web
volumeMounts:
- name: www
mountPath: /usr/share/nginx/html
volumes:
- name: www
persistentVolumeClaim:
claimName: my-pvc