liveBook · Manning

Kubectl

As explained in Data Pipelines with Apache Airflow, Second Edition

kubectl is the command-line client for interacting with Kubernetes clusters and resources.

kubectl is the command-line client for querying and managing Kubernetes clusters. In an Airflow deployment, it helps prepare namespaces, storage, services, and task pods before workflows run. section 11.5.2 section 11.5.1

A practical kubectl workflow includes:

  • Verify cluster access with kubectl cluster-info before creating resources. section 11.5.2 section 17.2.2
  • Create an Airflow namespace with kubectl create namespace airflow. section 11.5.2
  • Apply YAML specifications for persistent storage, claims, deployments, and services with kubectl apply -f. section 11.5.2
  • Inspect task pods with kubectl get pods, then investigate scheduling failures with kubectl describe pod. section 11.5.4

Diagnosing a pending Airflow task pod

When a task remains pending, first identify its pod with kubectl --namespace airflow get pods. Describe that pod to inspect recent events. A FailedScheduling event reporting a missing persistentvolumeclaim points to a missing storage resource; apply resources/data-volume.yml, then describe the pod again to confirm scheduling. section 11.5.4

Listing 11.20 Deploying the storage resources using kubectl
$ kubectl --namespace airflow apply -f resources/data-volume.yml
persistentvolumeclaim/data-volume created
persistentvolume/data-volume created

The command listing shows how kubectl applies a storage specification inside the Airflow namespace and reports the created resources. section 11.5.2

How Data Pipelines with Apache Airflow, Second Edition covers it

How deep it goes
Demonstrates connection checks, namespace and resource commands, and pod diagnosis, but does not detail kubectl command syntax broadly.
Examples
Uses cluster-info, namespace creation, YAML application, pod listing, port forwarding, and describe output showing a missing storage claim.
What it assumes
Assumes access to a Kubernetes cluster and an installed client, while introducing namespaces, pods, storage claims, and services through commands.
What you can do after
Operate and diagnose Kubernetes resources for Airflow by verifying access, applying specifications, inspecting pods, and interpreting scheduling events.
How it connects
Connects Kubernetes clusters, namespaces, YAML resources, persistent volumes, services, pods, and Airflow task execution.

Also explained in

Compare how 11 books explain kubectl →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Pipelines with Apache Airflow, Second Edition. The section links point to the parts of the book it draws on.