liveBook · Manning

Static queue

As explained in Kubernetes for Developers

A static queue is a finite work assignment in which the number of tasks is declared in advance and a separate workload instance processes each task.

A static queue assigns a known number of tasks before processing begins. A Kubernetes Job creates a separate Pod for each task, moving task-assignment logic from the worker container into Kubernetes configuration. section 10.3.2

Use a static queue when:

  • The total task count is known in advance and can be configured as Job completions. section 10.3.2
  • Tasks have natural indexes, allowing each Pod to receive its task number through JOB_COMPLETION_INDEX. section 10.3.2
  • The worker should not implement dynamic-queue retrieval, accepting more Kubernetes-side configuration instead. section 10.3.2

Rendering animation frames

Declare 30,000 completions for a 30,000-frame animation. Kubernetes creates Pods and supplies each frame number, letting every worker render its assigned frame. section 10.3.2

Listing 10.13 Chapter10/10.3.2_IndexedJob/indexed_job.yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: echo
spec:
  completions: 5                                                    #1
  parallelism: 3                                                    #2
  completionMode: Indexed                                           #3
  template:
    metadata:
      labels:
        pod: framerender
    spec:
      restartPolicy: Never
      containers:
      - name: 'worker'
        image: 'docker.io/library/busybox'
        command: ["echo", "render frame: $(JOB_COMPLETION_INDEX)"]  #4

Inspect the Indexed Job manifest: completions sets the task count, parallelism limits concurrent Pods, and completionMode enables indexed assignments. section 10.3.2

How Kubernetes for Developers covers it

How deep it goes
Explains worker and Kubernetes responsibilities, indexed completions, parallelism, and tradeoffs, but does not detail the other queue representations.
Examples
Demonstrates rendering animation frames and echoing five indexed frame numbers from completed Pods.
What you can do after
Operate/configure indexed Kubernetes Jobs with declared completions, parallelism, and per-Pod task indexes.
How it connects
Connects dynamic queues, Kubernetes Jobs, Pods, indexed workloads, and sidecar containers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes for Developers. The section links point to the parts of the book it draws on.