Terminal, Git, and YAML essentials
You will be able to: read any command in the walkthroughs before running it, and read a manifest in four passes.
Shell
| Syntax | Meaning |
|---|---|
cmd --flag value | Option with value |
a | b | Pipe a's output into b |
a && b | Run b only if a succeeded |
> file | Overwrite file (destructive) |
<name> | Placeholder. Replace it, brackets included |
Ctrl+C | Stop a foreground watch or port-forward |
pwdshows where you are; relative paths start there.- Check cluster, namespace and directory before any command that changes things.
Git (only these)
git status --short # empty = clean
git rev-parse HEAD # exact commit
- Use a dedicated clone. Pinned commit: see setup.
YAML
- Indentation = nesting. Spaces only, never tabs.
key: valueis a mapping.- itemis a list entry.
apiVersion: v1 # 1. what type
kind: Pod
metadata: # 2. name, namespace, labels
name: booking
labels:
app: booking
spec: # 3. desired state
containers: # list
- name: booking
image: example/booking:1.0
ports:
- containerPort: 8082
Four passes over any manifest:
apiVersion+kind: which object?metadata: name, namespace, labels.spec: desired state.- References: which names and labels must match exactly (selectors,
secretKeyRef,serviceName)?
Gotchas
- Key order does not mean execution order.
- A valid manifest can still point at a missing name.
kubectl applysucceeding means the API accepted it. Nothing more.
Check yourself
containers: is followed by two lines starting - name:. What is that?
A list of two container definitions.
Does a successful kubectl apply prove the app works?
No. Only that the API accepted the object. Controllers, scheduling and the request path still need checking.
Next: Meet Apollo Airlines.