Configuring podAntiAffinity for the connectware-agent Helm Chart

Configuring podAntiAffinity

The connectware-agent Helm chart uses Kubernetes inter-pod anti-affinity to distribute configured agents across different Kubernetes nodes. The chart offers three modes of anti-affinity which you can choose with the podAntiAffinity value inside the agent’s entry in the protocolMapperAgents context of your values.yaml file:

Mode
Effect

soft (default)

Will try to schedule agent pods on different Kubernetes nodes, but will schedule them on the same node if not possible otherwise.

hard

Will schedule agent pods only on different nodes. If there are not enough matching nodes available, agents will not be scheduled.

none

Will not add anti-affinity rules to the agents.

Example

protocolMapperAgentDefaults:
    connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
    podAntiAffinity: hard # agents will only be scheduled on different Kubernetes nodes
protocolMapperAgents:
    - name: bender-robots
    - name: welder-robots # will not be scheduled on the same Kubernetes node as bender-robots agent

(Advanced) Overriding podAntiAffinity Options

If you want to configure very specific pod anti-affinity rules to match your Kubernetes cluster setup, you can use the values of the podAntiAffinityOptions section inside the agent’s entry in the protocolMapperAgents section of your values.yaml file.

Configuring podAntiAffinity Topology Key To change topology key used for the agent’s pod anti-affinity, specify the topology key in the podAntiAffinityOptions.topologyKey value inside the agent’s entry in the protocolMapperAgents context of your values.yaml file.

Example

protocolMapperAgentDefaults:
    connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
    podAntiAffinity: hard # agents will only be scheduled on different availability zones
    podAntiAffinityOptions:
        topologyKey: topology.kubernetes.io/zone
protocolMapperAgents:
    - name: bender-robots
    - name: welder-robots # will not be scheduled on the same availability zone as bender-robots agent

Configuring podAntiAffinity Match Expression

To change match expression used for the agent’s pod anti-affinity, specify the values podAntiAffinityOptions.key, podAntiAffinityOptions.operator, podAntiAffinityOptions.value, value inside the agents entry in the protocolMapperAgents section of your values.yaml file.

Example

protocolMapperAgentDefaults:
    connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
    # Agents will not be scheduled on the same Kubernetes nodes as other agents.
    # This is also true for agents installed through other instances of this Helm chart.
    podAntiAffinity: hard
    podAntiAffinityOptions:
        key: app.kubernetes.io/component
        operator: In
        value: protocol-mapper-agent
protocolMapperAgents:
    - name: bender-robots
    - name: welder-robots # will not be scheduled on the same Kubernetes node as bender-robots agent

Last updated

Was this helpful?