KubernetesPodOperator specify dictionary resources

3/19/2020

Somehow if I specify resource in my KubernetesPodOperator, the DAG will fail. Looks like the pod is created at least it attempts to create it. The log says Event: XXXXX-e59a4be6 had an event of type Pending.

resource_config = {'limit_memory': 1, 'limit_cpu': 1, 'request_memory': 1, 'request_cpu': 1}

dagA = KubernetesPodOperator(
            name="podA", namespace='my-app', task_id="task1", resources=resource_config,
    ...

If I don't specify the resource, it will run. The resource param is of type dictionary looking at code.

Did anyone have this issue?

-- alltej
airflow
kubernetes
kubernetes-pod

1 Answer

3/19/2020

I found a solution. Specifying a whole integer values does not work based on the examples here. This resource spec works:

resource_config = {'limit_memory': '1024Mi', 'limit_cpu': '500m'}

So I think that is the correct way for specifying the values.

-- alltej
Source: StackOverflow