Menu
Coddy logo textTech

Writing A Manifest

Part of the Introduction to Kubernetes section of Coddy's Terminal journey. Lesson 8 of 45.

Flags on kubectl run are fine for quick experiments, but real clusters are described in files. A manifest is a YAML file that says what you want to exist:

apiVersion: v1
kind: Pod
metadata:
  name: hello
spec:
  containers:
    - name: hello
      image: nginx

Every manifest has the same four parts. apiVersion and kind say what type of object it is (a Pod from the core v1 API). metadata holds the name. spec describes the desired state: here, one container named hello running the nginx image.

YAML cares about indentation: nested fields are indented with spaces, and a list item starts with a dash.

To create what a manifest describes, apply the file:

kubectl apply -f pod.yaml

Kubernetes answers pod/hello created, exactly as if you had used kubectl run.

In these lessons the file tree next to the terminal holds the manifest for you. Click it to open it in the editor, make your changes, and press Save. The terminal then sees the new content.

challenge icon

Challenge

Easy

A manifest named pod.yaml is in your directory with two blanks. Open it from the file tree, set the Pod's name to hello and the container image to nginx, and save it. Then apply the file and list the Pods.

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Introduction to Kubernetes

Practice on your own: Terminal playground