Skip to content

KubernetesJobOperator is not creating jobs using official chart #50595

@avikbesu

Description

@avikbesu

Official Helm Chart version

1.15.0

Apache Airflow version

2.9.3

Kubernetes Version

1.30.11

Helm Chart configuration

No response

Docker Image customizations

Official image

What happened

No response

What you think should happen instead

kubernetes.client.exceptions.ApiException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'dfbb1c2d-dcb8-49d8-baf5-ac246888f021', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Content-Type-Options': 'nosniff', 'X-Kubernetes-Pf-Flowschema-Uid': '039c3e74-af96-47d4-9d83-a3630033db89', 'X-Kubernetes-Pf-Prioritylevel-Uid': 'cbb01a5d-c107-49cf-84ec-2140416514a1', 'Date': 'Tue, 14 May 2025 09:54:14 GMT', 'Content-Length': '323'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"jobs.batch is forbidden: User \"system:serviceaccount:data-dev:airflow-scheduler\" cannot create resource \"jobs\" in API group \"batch\" in the namespace \"data-dev\"","reason":"Forbidden","details":{"group":"batch","kind":"jobs"},"code":403}

How to reproduce

Updated kubernetes Pod Operator to Job Operator and it is failing for missing permission to create kube job.

KubernetesPodOperator(
task_id="run_custom_pod",
namespace="airflow",
image="busybox:latest", # Main container image
name="custom-pod",
on_finish_action="keep_pod",
init_containers=[{"name": f"init-container-{i}", "image": "", "entrypoint": []} for i in range(2)]
)

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions