Difference between revisions of "PodAntiAffinity"

From wikieduonline
Jump to navigation Jump to search
(Created page with " Elasticsearch example, official doc: <ref>https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-advanced-node-scheduling.html#k8s_a_single_elasticsearch_node_per_ku...")
 
 
(2 intermediate revisions by 2 users not shown)
Line 4: Line 4:
  
 
[[Elasticsearch]] example, official doc: <ref>https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-advanced-node-scheduling.html#k8s_a_single_elasticsearch_node_per_kubernetes_host_default</ref>
 
[[Elasticsearch]] example, official doc: <ref>https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-advanced-node-scheduling.html#k8s_a_single_elasticsearch_node_per_kubernetes_host_default</ref>
<pre>
+
 
apiVersion: elasticsearch.k8s.elastic.co/v1
+
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
+
kind: Elasticsearch
metadata:
+
metadata:
  name: quickstart
+
  name: quickstart
spec:
+
spec:
  version: 8.4.3
+
  version: 8.4.3
  nodeSets:
+
  nodeSets:
  - name: default
+
  - name: default
    count: 3
+
    count: 3
    podTemplate:
+
    podTemplate:
      spec:
+
      spec:
        affinity:
+
        [[affinity:]]
          podAntiAffinity:
+
          podAntiAffinity:
            preferredDuringSchedulingIgnoredDuringExecution:
+
            preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
+
            - weight: 100
              podAffinityTerm:
+
              podAffinityTerm:
                labelSelector:
+
                [[labelSelector:]]
                  matchLabels:
+
                  matchLabels:
                    elasticsearch.k8s.elastic.co/cluster-name: quickstart
+
                    elasticsearch.k8s.elastic.co/cluster-name: quickstart
                topologyKey: kubernetes.io/hostname
+
                [[topologyKey:]] [[kubernetes.io/hostname]]
</pre>
+
 
 +
 
 +
== See also ==
 +
* [[Kubernetes pod affinity and anti affinity]]

Latest revision as of 15:56, 16 December 2022



Elasticsearch example, official doc: [1]

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
spec:
  version: 8.4.3
  nodeSets:
  - name: default
    count: 3
    podTemplate:
      spec:
        affinity:
          podAntiAffinity:
            preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchLabels:
                    elasticsearch.k8s.elastic.co/cluster-name: quickstart
                topologyKey: kubernetes.io/hostname


See also[edit]

  • https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-advanced-node-scheduling.html#k8s_a_single_elasticsearch_node_per_kubernetes_host_default
  • Advertising: