Private images with Airflow KubernetesPodOperator

8/21/2018

I am getting started with Airflow and trying to use the KubernetesPodOperator, but I am having trouble with downloading images from private registries. I did some research but I couldn't find an answer to my problem.

Putting it simply: can I use private images from DockerHub with the KubernetesPodOperator?

-- hscasn
airflow
kubernetes

2 Answers

3/20/2019

Yes, you can. The KubernetesPodOperator accepts an imagePullSecret since version 1.10.1

:param image_pull_secrets: Any image pull secrets to be given to the pod.
                           If more than one secret is required, provide a
                           comma separated list: secret_a,secret_b
:type image_pull_secrets: str

References: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ https://github.com/apache/airflow/blob/master/airflow/contrib/operators/kubernetes_pod_operator.py

-- Arigion
Source: StackOverflow

8/22/2018

It looks like pod_generator.PodGenerator accepts some kind of object kube_config that knows about imagePullSecrets, but unfortunately KubernetesPodOperator doesn't provide any such kube_config to PodGenerator

As best I can tell, it's just an edge case that slipped through the cracks, although it looks like there is a Jira for that which matches up with a corresponding GitHub PR, but it isn't clear from looking at the changed files that it will 100% solve the problem you are describing. Perhaps weigh in on either the PR, or the Jira, or maybe even both, to ensure it is addressed.

-- mdaniel
Source: StackOverflow