liveBook · Manning

Kubectl apply

As explained in Learn Docker in a Month of Lunches, Second Edition

kubectl apply is a kubectl command that creates or updates Kubernetes resources from declarative configuration.

kubectl apply sends declarative YAML models to a Kubernetes cluster, creating or updating the resources described by fields such as apiVersion, kind, metadata, and spec. section 15.2

Deploy and observe a Pod

Run kubectl apply -f ch15/exercises/pi/pod.yaml, then kubectl get pods and kubectl logs pi. If the container exits, Kubernetes repeatedly replaces it; repeated failures can produce CrashLoopBackOff. section 15.2

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains the command through runnable Pod and Service workflows, stopping short of detailed apply internals.
Examples
Uses basic Pod YAML, a random-number API Pod, and a Service applied with kubectl apply.
What you can do after
Operate/configure Kubernetes resources, then verify them with kubectl get, describe, logs, and watch.
How it connects
Connects declarative configuration with Pods, Services, labels, selectors, desired state, and CrashLoopBackOff.

Also explained in

Compare how 6 books explain kubectl apply →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.