Last active
June 13, 2019 16:55
-
-
Save liejuntao001/f980832818b484a69116cdc6fbbf71e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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