liveBook · Manning

Kubernetes manifest

As explained in Spring in Action, Sixth Edition

A deployment manifest is a declarative configuration document that specifies how Kubernetes should deploy and operate an application workload.

A Kubernetes manifest is a declarative YAML document that tells Kubernetes how to deploy and operate an application workload. A deployment manifest names the deployment, selects the container image, and specifies how many instances should run. section 18.3.1

apiVersion: apps/v1
kind: Deployment
metadata:
  name: taco-cloud-deploy
  labels:
    app: taco-cloud
spec:
  replicas: 3
  selector:
    matchLabels:
      app: taco-cloud
  template:
    metadata:
      labels:
        app: taco-cloud
    spec:
      containers:
      - name: taco-cloud-container
        image: tacocloud/tacocloud:latest

The manifest defines a Deployment with three replicas, matching labels, and a container based on the Taco Cloud image. section 18.3.1

A practical manifest can also connect deployment to application health:

  • Set replicas to 3 so Kubernetes maintains three running container instances and replaces one when it fails. section 18.3.1
  • Configure liveness and readiness probes to query Spring Boot Actuator endpoints on port 8080 every five seconds after an initial delay. section 18.3.3
  • Use readiness to prevent traffic from reaching an unavailable application, and liveness to let Kubernetes replace a failed pod. section 18.3.3

Apply and inspect a deployment

Save the manifest as deploy.yaml, apply it with kubectl apply -f deploy.yaml, and inspect the resulting pods and deployment with kubectl get all. For local access, forward a pod's port with kubectl port-forward. section 18.3.1

How Spring in Action, Sixth Edition covers it

How deep it goes
Defines replicas, selectors, images, and health probes, while deferring the broader mechanics of Kubernetes deployment specifications.
Examples
Uses a Taco Cloud Deployment, three replicas, kubectl commands, and Actuator health endpoints as concrete examples.
What it assumes
Assumes a Kubernetes environment and a previously built container image, while introducing manifest structure and kubectl application.
What you can do after
Operate/configure a Kubernetes deployment with kubectl, replicas, container images, and application health probes.
How it connects
Connects container images, Kubernetes Deployments, kubectl, Spring Boot Actuator, liveness probes, and readiness probes.

Also explained in

Compare how 10 books explain Kubernetes manifest →

Related concepts

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