While executing this tasks, When i gave kubectl logs "name-of-pod". It doesnt pr . . .

Anushka hasini:
While executing this tasks, When i gave kubectl logs “name-of-pod”. It doesnt print log message rather it displays error message of container name must be specified. But it works for other pod. How do we know about this difference.

Mohamed Ayman:
Hello @Anushka hasini,
You can use the describe command to know how many containers the pod has because in case there is more than one container in the pod, you should specify the container name in your command like this kubectl logs webapp-2 -c simple-webapp

Alistair Mackay:
Note that with bash autocomplete installed (this is installed by default in the exam), you can simply do

kubectl logs webapp-2 TAB TAB TAB ...

Hitting the TAB key will cycle through the container names till you find the one you want.

To install bash autocomplete in lab terminal, run

source <(kubectl completion bash)

at the command prompt

Anushka hasini:
Ok thanks

Mohamed Ayman:
You are welcome.
Happy learning!