UNCLASSIFIED - NO CUI

Skip to content

Node Affinity and Virtual Service Updates

Ismail Ahmad requested to merge ia-nodeaffinity-vs into main

VIRTUAL SERVICE:

What:

  • Allows the ability to configure the subdomain via values.yaml

Why:

  • So customers can modify the full url to fit their environment.

Closes #7 (closed)

NODE AFFINTITY:

What:

  • Adds the ability to create pod antiaffinity and node affinity

Why:

  • to allow customers to pin es pods to certain k8s nodes
  • to allow customers to run es pods on separate k8s nodes

Supporting info:

Kubernetes Nodes with "elastic:true" label

$ kubectl get nodes -l elastic=true

NAME                                              STATUS   ROLES    AGE     VERSION
ip-10-255-XXX-15.us-gov-west-1.compute.internal   Ready    <none>   6d10h   v1.18.12+rke2r2
ip-10-255-XXX-31.us-gov-west-1.compute.internal   Ready    <none>   6d10h   v1.18.12+rke2r2
ip-10-255-XXX-160.us-gov-west-1.compute.internal   Ready    <none>   6d10h   v1.18.12+rke2r2

Elastic Master with node affinity

$ kubectl get po ismail-elastic-es-master-0 -o yaml | grep -A 7 "nodeAffinity:"

    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: elastic
            operator: In
            values:
            - "true"

Elastic Master with pod anti ffinity

$ kubectl get po ismail-elastic-es-master-0 -o yaml | grep -A 9 "podAntiAffinity"
    podAntiAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
      - podAffinityTerm:
          labelSelector:
            matchLabels:
              elasticsearch.k8s.elastic.co/cluster-name: ismail-elastic
              elasticsearch.k8s.elastic.co/node-master: "true"
              elasticsearch.k8s.elastic.co/statefulset-name: ismail-elastic-es-master
          topologyKey: kubernetes.io/hostname
        weight: 1

Elastic Master with running on correct nodes

$ kubectl get po -l elasticsearch.k8s.elastic.co/statefulset-name=ismail-elastic-es-master -o wide

NAME                         READY   STATUS    RESTARTS   AGE     IP           NODE                                              NOMINATED NODE   READINESS GATES
ismail-elastic-es-master-0   1/1     Running   0          11m     10.42.2.78   ip-10-255-XXX-15.us-gov-west-1.compute.internal   <none>           <none>
ismail-elastic-es-master-1   1/1     Running   0          7m47s   10.42.5.59   ip-10-255-XXX-31.us-gov-west-1.compute.internal   <none>           <none>
ismail-elastic-es-master-2   1/1     Running   0          6m49s   10.42.2.80   ip-10-255-XXX-15.us-gov-west-1.compute.internal   <none>           <none>

Closes #5 (closed)

Edited by Ismail Ahmad

Merge request reports