Pods
- kubectl get pods
- kubectl describe pod
- Command Line in Pod – kubectl exec –stdin –tty – /bin/bash
- kubectl logs
- Logs from previous instance of pod – kubectl logs -p
Apply Yaml files
- kubectl apply -f
- kubectl apply -f (runs all yamls in the folder)
Diagnose failed start for container:
If your pod and deployment are failing to start and they do not record any logs when using “logs -p” then you can add a terminationMessagePath to your Deployment spec which will help trap the last error that occurs and log it for you.
Add the terminationMessagePath to your Deployment spec as follows:
spec:
replicas: 1
selector:
matchLabels:
app: ghost-blog
template:
metadata:
labels:
app: ghost-blog
spec:
containers:
- name: ghost-blog
image: ghost:4
terminationMessagePath: "/tmp/my-log" #ADD THIS LINE
Now run kubectl apply again
kubectl apply -f [filename]
It will fail again however this time you can go to your pods and describe the pod and get an error message included that will hopefully shed light on your problem.

Leave a comment