liveBook · Manning

Suspend field

As explained in Kubernetes in Action, Second Edition

The suspend field is a Kubernetes Job specification field that controls whether execution of the Job is suspended.

The suspend field controls whether a Kubernetes Job executes. Set it to true to create a suspended Job; set it to false to allow execution. section 18.1.1

Create a suspended Job

Add `suspend: true` under the Job’s `spec`. Applying this manifest creates the Job object without creating any Pods. The Job records a Suspended event. section 18.1.1

Control the Job with kubectl:

  • Resume it with `kubectl patch job demo-suspend -p '{"spec":{"suspend": false}}'`; the Job controller creates the Pod and records that the Job resumed. section 18.1.1
  • Suspend a running Job with `kubectl patch job demo-suspend -p '{"spec":{"suspend": true}}'`; the controller immediately deletes its associated Pod and shuts down its containers gracefully. section 18.1.1

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains manifest configuration and controller lifecycle effects, stopping short of broader scheduling or retry behavior.
Examples
Uses a BusyBox sleep Job, Pod listings, controller Events, and kubectl patch commands to demonstrate suspension and resumption.
What it assumes
Assumes familiarity with Kubernetes Job manifests and kubectl, while demonstrating the suspend field from its manifest entry onward.
What you can do after
Operate/configure Jobs by creating them suspended, resuming them, or suspending active execution with kubectl patch.
How it connects
Connects the suspend field to Kubernetes Jobs, Pods, the Job controller, kubectl patch, and Events.

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