Search⌘ K
AI Features

Defining Our Deployment Manifest

Explore how to create and apply Kubernetes deployment manifests to manage pods. Understand key elements like replicas, selectors, and template specifications. This lesson guides you in linking deployments to pods using labels and demonstrates inspecting deployment states and pod behavior in a cluster.

We'll cover the following...

Deployment Manifest

Just like we defined a manifest for our nginx pod, we need to define a manifest for a deployment, and they actually look fairly similar:

YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: hellok8s
spec:
replicas: 1
selector:
matchLabels:
app: hellok8s
template:
metadata:
labels:
app: hellok8s
spec:
containers:
- image: brianstorti/hellok8s:v1
name: hellok8s-container

Let’s go through all the fields in this manifest to understand what’s happening. First, we tell Kubernetes what kind of object we are defining here. In our case, this is a Deployment.

In the metadata.name field, we define a unique name for our deployment. This can be anything that helps you identify what this deployment is managing.

In the spec section, we define what this ...