kubernetes-yaml/learn/learn-kubernetes-master/kiamol/ch08/lab/solution/nginx-statefulset.yaml

50 lines
898 B
YAML

apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
kiamol: ch08-lab
spec:
type: LoadBalancer
ports:
- port: 8088
targetPort: 80
selector:
app: nginx-stateful
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nginx-stateful
labels:
kiamol: ch08-lab
spec:
selector:
matchLabels:
app: nginx-stateful
serviceName: nginx-stateful
replicas: 3
template:
metadata:
labels:
app: nginx-stateful
spec:
containers:
- image: nginx:1.17-alpine
name: nginx
ports:
- containerPort: 80
volumeMounts:
- name: logs
mountPath: /var/log/nginx/
volumeClaimTemplates:
- metadata:
name: logs
labels:
kiamol: ch08-lab
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi