Skip to content

Instantly share code, notes, and snippets.

@azhuox
Created November 30, 2020 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azhuox/ef54bc01057f82be160b4cc2c5331076 to your computer and use it in GitHub Desktop.
Save azhuox/ef54bc01057f82be160b4cc2c5331076 to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment-demo
spec:
selector:
matchLabels:
app: nginx
env: demo
replicas: 3
strategy:
rollingUpdate:
maxUnavailable: 0
template:
metadata:
labels:
app: nginx
env: demo
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- us-central1-a
- us-central1-b
- us-central1-c
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- nginx
topologyKey: kubernetes.io/hostname
containers:
- name: nginx
image: nginx:1.15.3
ports:
- containerPort: 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment