I am scheduling some tasks on airflow using KubernetesPodOperator
; I want to deploy my pod with custom dns configuration:
spec:
dnsPolicy: "None"
dnsConfig:
nameservers:
- 10.10.10.10
But the problem is I found no way to set dns config and nameserver KubernetesPodOperator
. So does anybody have a solution to submit a task on k8s in airflow with custom dns config?
Airflow expose the Kubernetes Pod object API so your configuration should work As listed dnsConfig in the Pod Spec.
apiVersion: v1
kind: Pod
metadata:
namespace: default
name: dns-example
spec:
containers:
- name: test
image: nginx
dnsPolicy: "None"
dnsConfig:
nameservers:
- 10.10.10.10
Make sure you are importing the updated version of KubernetesPodOperator
from providers.
For Airflow< 2.0.0: use backport providers.
For Airflow>= 2.0.0 use providers.