Hint: Set executor = KubernetesExecutor in airflow.cfg [OK]
Common Mistakes:
Using LocalExecutor or CeleryExecutor by mistake
Misspelling KubernetesExecutor
Changing unrelated config keys
3. Given this Airflow task using Kubernetes executor, what happens when the DAG runs?
from airflow import DAG
from airflow.operators.bash import BashOperator
from datetime import datetime
with DAG('example', start_date=datetime(2024,1,1)) as dag:
task = BashOperator(task_id='print_date', bash_command='date')
medium
A. The task runs inside a new Kubernetes pod created dynamically.
B. The task runs on the Airflow scheduler machine only.
C. The task fails because BashOperator is not supported with Kubernetes executor.
D. The task runs on a fixed worker node without pod creation.
Solution
Step 1: Understand task execution with Kubernetes executor
When using Kubernetes executor, each task runs inside its own pod created dynamically in the Kubernetes cluster.
Step 2: Analyze the given BashOperator task
The BashOperator runs a simple shell command. With Kubernetes executor, this command runs inside a new pod, not on the scheduler or fixed node.
Final Answer:
The task runs inside a new Kubernetes pod created dynamically. -> Option A
Quick Check:
BashOperator + Kubernetes executor = dynamic pod run [OK]
Hint: Kubernetes executor runs each task in a new pod [OK]
Common Mistakes:
Assuming tasks run on scheduler machine
Thinking BashOperator is unsupported
Believing pods are not created dynamically
4. You configured Airflow with Kubernetes executor but tasks are not running and pods are not created. What is the most likely cause?
medium
A. The Kubernetes cluster credentials are missing or incorrect.
B. The DAG file has syntax errors unrelated to executor.
C. The Airflow scheduler is running with LocalExecutor.
D. The BashOperator command is invalid.
Solution
Step 1: Check Kubernetes executor requirements
Kubernetes executor needs valid cluster credentials to create pods dynamically.
Step 2: Identify why pods are not created
If no pods appear, missing or wrong Kubernetes credentials is the most common cause, blocking pod creation.
Final Answer:
The Kubernetes cluster credentials are missing or incorrect. -> Option A
Quick Check:
No pods + Kubernetes executor = check cluster credentials [OK]
Hint: No pods? Verify Kubernetes credentials first [OK]
Common Mistakes:
Blaming DAG syntax errors
Assuming scheduler executor type is unrelated
Thinking BashOperator command causes pod creation failure
5. You want to optimize Airflow with Kubernetes executor to handle many short tasks efficiently. Which approach helps reduce pod startup overhead?
hard
A. Increase task retries to avoid pod creation failures.
B. Use pod templates with pre-configured settings and enable pod reuse.
C. Disable Kubernetes executor and switch to SequentialExecutor.
D. Run all tasks in a single pod to save resources.
Solution
Step 1: Understand pod startup overhead in Kubernetes executor
Each pod creation takes time, so reducing overhead improves efficiency for many short tasks.
Step 2: Identify optimization methods
Using pod templates with pre-set configs and enabling pod reuse reduces startup time and resource use.
Step 3: Evaluate other options
Disabling Kubernetes executor or running all tasks in one pod loses scaling benefits. Increasing retries does not reduce pod startup time.
Final Answer:
Use pod templates with pre-configured settings and enable pod reuse. -> Option B
Quick Check:
Pod reuse + templates = faster task startup [OK]
Hint: Use pod templates and reuse to speed up pods [OK]
Common Mistakes:
Switching to SequentialExecutor loses scaling
Running all tasks in one pod breaks isolation
Increasing retries does not reduce pod startup
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.