What you’ll see in the terminal

The pictures are nice, but at the exam you only get a terminal. Here's what the shop looks like from there, and how to read it.

kubectl get deployment

$ kubectl get deployment shop
NAME   READY   UP-TO-DATE   AVAILABLE   AGE
shop   3/3     3            3           2m
1

READY 3/3: ready Pods out of the number you asked for. 2/3 means one is missing or not ready yet.

2

UP-TO-DATE: Pods already on the latest recipe (matters during updates, chapter 8).

3

AVAILABLE: Pods ready to take customers.

kubectl get pods -o wide

$ kubectl get pods -o wide
NAME                   READY  STATUS   RESTARTS  AGE  IP          NODE
shop-7d9c5b8f4-xk2pq   1/1    Running  0         2m   10.0.1.12   node-1
shop-7d9c5b8f4-m8vtn   1/1    Running  0         2m   10.0.2.7    node-2
shop-7d9c5b8f4-b4wlz   1/1    Running  0         20s  10.0.3.4    node-3
1

NAME: Deployment, then ReplicaSet hash, then a random suffix.

2

READY 1/1: ready containers out of the containers in the Pod.

3

STATUS: Running, Pending (no ship yet), ContainerCreating, CrashLoopBackOff (chapter 2), ImagePullBackOff (the image can't be downloaded).

4

RESTARTS: how often the kubelet restarted its containers in place (the Pod stays the same Pod). A climbing number means trouble.

5

AGE 20s on the last one: a replacement. IP and NODE show where each Pod landed (-o wide adds these).

kubectl get service

$ kubectl get service shop
NAME   TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
shop   ClusterIP   10.96.41.200   <none>        80/TCP    1m
1

CLUSTER-IP: the Pharos's fixed address. It never changes, even as Pods come and go.

2

PORT(S) 80/TCP: the port callers use. The targetPort doesn't show here; use describe.

kubectl describe pod

$ kubectl describe pod shop-7d9c5b8f4-b4wlz
...
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  20s   default-scheduler  Assigned to node-3
  Normal  Pulled     19s   kubelet            Image "shop:1.0" already present
  Normal  Created    19s   kubelet            Created container: shop
  Normal  Started    19s   kubelet            Started container shop
1

The Events at the bottom tell the Pod's story in order (Age says how long ago): scheduled, pulled, created, started. When something breaks, the reason is almost always here.

Add --show-labels to any get command to see the name tags, and -l app=shop to show only Pods wearing one. Both come up constantly in the exam.