Lesson 2 · Unit 01
Pods and manifests
The four parts of a manifest, what a Pod shares, and three commands to read one.
What you practise
- A manifest's four parts (
apiVersion,kind,metadata,spec), containers in a pod,kubectl get,describeandlogs
Try a question from this lesson
Pick one
This file asks the cluster to run one container. Which top-level part says what you want, as opposed to what kind of thing it is or what it is called?
apiVersion: v1
kind: Pod
metadata:
name: web
labels:
app: web
spec:
containers:
- name: web
image: shop/web:1.4
ports:
- containerPort: 80Hint
Three of the parts identify the object. Find the one that describes containers.
Correct answer
spec
Why
spec is the desired state: which containers, from which image. apiVersion and kind say what type of object this is, and metadata names and labels it. Every Kubernetes object is laid out this way.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Four parts in every manifest
A manifest is a file describing one object. It always has the same four parts.
apiVersion and kind: which type of object, and which version of its schema. metadata: its name and labels. spec: the state you want.
A Pod is the smallest thing Kubernetes runs: one or more containers started together on one node. Once it exists, the cluster adds a fifth part, status, recording what is actually true. You write spec. The cluster writes status.
Concept
What the containers in a Pod share
Most Pods hold one container. A Pod holds more when they must live and die together, such as an app and a helper that ships its logs.
Containers in one Pod share a network identity: the Pod has one IP address, and its containers reach each other on localhost. They can also share files through a volume.
In Docker each container had its own network identity. Here the Pod has it.
Pod web IP 10.244.1.7
+-------------------------------+
| app :8080 log-shipper |
| localhost |
+-------------------------------+9 more exercises in the app
- 1× fill the blanks
- 2× true or false
- 3× multiple choice
- 1× match the pairs
- 1× type the answer
- 1× order the lines
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.