Skip to content

Instantly share code, notes, and snippets.

@darioblanco
Created March 21, 2019 17:25
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 darioblanco/b9192c8b3ef96b1abe8d57de97e58993 to your computer and use it in GitHub Desktop.
Save darioblanco/b9192c8b3ef96b1abe8d57de97e58993 to your computer and use it in GitHub Desktop.
Example of pod anti affinity with label
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mypod
labels:
app: mypod-app
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: mypod-app
topologyKey: "kubernetes.io/hostname"
containers:
- name: mypod-container
image: k8s.gcr.io/mypodcontainer:2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment