Search⌘ K
AI Features

Defining Our Deployment Manifest

Explore how to create and apply a Kubernetes deployment manifest to manage pods effectively. Understand the key fields like replicas, selectors, and templates that link deployments to pods. Gain hands-on experience inspecting deployments and pods to verify desired and current states in your Kubernetes 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 deployment will do. First, we define how many replicas we want. That is, how many exact copies of this pod we want to run. For now, we’re running just one replica, but we will play with that field in a ...