Kubernetes: Affinity depending on Azure Availability Set

5/29/2019

Requirement

Kubernetes in Azure uses Availability Sets as the default availability strategy.

I can specify the kubernetes nodeSelector attribute to select a specific node.

kind: Pod
... 
spec:
  ...   
  nodeSelector:
    ???

Question

Can I specify the nodeSelector rule to use a node in a specific Availability Set?

I could label the pods manually after creation. But is there an automatic solution?

-- Matthias M
azure
azure-aks
kubernetes

1 Answer

5/30/2019

first of all, this question makes no sense, as with availability sets you can only have 1 node pool with AKS (and your tags mention AKS) (at least supported). but still, nodes have labels that look like this:

agentpool=pool_name

so your node selector would looks like this:

  nodeSelector:
    agentpool: pool_name
-- 4c74356b41
Source: StackOverflow