Difference between revisions of "Kubernetes pod affinity and anti affinity"
Jump to navigation
Jump to search
Line 57: | Line 57: | ||
− | {{K8s}} | + | {{K8s pods}} |
Revision as of 16:57, 20 September 2022
https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity
Official example
apiVersion: v1 kind: Pod metadata: name: with-node-affinity spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: topology.kubernetes.io/zone operator: In values: - antarctica-east1 - antarctica-west1 preferredDuringSchedulingIgnoredDuringExecution: - weight: 1 preference: matchExpressions: - key: another-node-label-key operator: In values: - another-node-label-value containers: - name: with-node-affinity image: registry.k8s.io/pause:2.0
Pods: kubectl apply
, kubectl [ pod get | top | delete | describe pods ]
, InitContainers, PodInitializing, CrashLoopBackOff, ImagePullPolicy:, NodeAffinity, NodeSelector, Terminated
Advertising: