I am encountering a weird behavior when I try to attach podAffinity to the Scheduler deployment from the official Airflow helm chart, like:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- postgresql
topologyKey: "kubernetes.io/hostname"
With an example Deployment to which the podAffinity should "hook up" to:
metadata:
name: {{ template "postgresql.fullname" . }}
labels:
app: postgresql
chart: {{ template "postgresql.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
serviceName: {{ template "postgresql.fullname" . }}-headless
replicas: 1
selector:
matchLabels:
app: postgresql
release: {{ .Release.Name | quote }}
template:
metadata:
name: {{ template "postgresql.fullname" . }}
labels:
app: postgresql
chart: {{ template "postgresql.chart" . }}
Which results in:
NotTriggerScaleUp: pod didn't trigger scale-up: 1 node(s) didn't match pod affinity/anti-affinity, 1 node(s) didn't match pod affinity rules
However, applying the same podAffinity config to the Webserver deployment works just fine. Plus, changing the example Deployment to a vanilla nginx manifested itself in the outcome.
It does not seem to be any resource limitation issue since I already tried various configs, every time with the same result. I do not use any custom configurations apart from node affinity.
Has anyone encounter the same or has any idea what I might do wrong?
Setup:
- AKS cluster
- Airflow helm chart 1.1.0
- Airflow 1.10.15 (but I don't think this matters)
- kubectl client (1.22.1) and server (1.20.7)
Links to Airflow charts: