Skip to content

Instantly share code, notes, and snippets.

@liejuntao001
Last active June 13, 2019 16:55
Show Gist options
  • Save liejuntao001/f980832818b484a69116cdc6fbbf71e5 to your computer and use it in GitHub Desktop.
Save liejuntao001/f980832818b484a69116cdc6fbbf71e5 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: testsvc-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: test
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: test
spec:
replicas: 5
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- name: whoami
image: jwilder/whoami
ports:
- containerPort: 8000
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",
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment