Created
February 8, 2018 00:57
-
-
Save CalvinHartwell/fe78709add3deab6d469dc8847bb40ab to your computer and use it in GitHub Desktop.
k8s-pod-affinity-rules
This file contains hidden or 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
| ...pod webserver | |
| $ cat webserver.yaml | |
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: webserver | |
| labels: | |
| appname: "webapp" | |
| spec: | |
| containers: | |
| - name: nginx | |
| image: nginx | |
| ... pod database | |
| $ cat database.yaml | |
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: database | |
| spec: | |
| affinity: | |
| podAffinity: | |
| requiredDuringSchedulingIgnoredDuringExecution: | |
| - labelSelector: | |
| matchExpressions: | |
| - key: appname | |
| operator: In | |
| values: | |
| - "webapp" | |
| topologyKey: kubernetes.io/hostname | |
| containers: | |
| - name: pod-affinity | |
| image: mysql | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment