Skip to content

Instantly share code, notes, and snippets.

@liejuntao001
Last active June 19, 2019 18:49
Show Gist options
  • Save liejuntao001/5f81d72ef8e052cc4dc0fe2a41be6181 to your computer and use it in GitHub Desktop.
Save liejuntao001/5f81d72ef8e052cc4dc0fe2a41be6181 to your computer and use it in GitHub Desktop.
kind: Service
apiVersion: v1
metadata:
name: testsvc
spec:
selector:
app: test
ports:
- protocol: TCP
port: 8001
targetPort: 8000
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: testsvc2-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: test
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test
labels:
app: test
spec:
replicas: 5
selector:
matchLabels:
app: test
serviceName: test
template:
metadata:
labels:
app: test
storageClassName: rook-ceph-block
annotations:
backup.velero.io/backup-volumes: whoami-data
spec:
containers:
- name: whoami
image: jwilder/whoami
ports:
- containerPort: 8000
volumeMounts:
- name: whoami-data
mountPath: /data
lifecycle:
preStop:
exec:
command: [
"sh", "-c",
# Introduce a delay to the shutdown sequence to wait for the
# pod eviction event to propagate. Then, gracefully shutdown
# nginx.
"sleep 6 && /usr/sbin/nginx -s quit",
]
volumeClaimTemplates:
- metadata:
name: whoami-data
spec:
storageClassName: rook-ceph-block
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 16Mi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment