13. Kubernetes Debugging

Published: 23 July 2022
on channel: iMustLearn
72
1

** Example:1 - With error ***
vi my-nginx-err.yaml

apiVersion: v1
kind: Pod
metadata:
name: my-nginx-err-pod
spec:
containers:
name: my-nginx-err-container
image: ngnx

kubectl create -f my-nginx-err.yaml

kubectl get pods

kubectl describe pod my-nginx-err-pod

kubectl logs my-nginx-err-pod

kubectl edit pods my-nginx-err-pod
kubectl get pods

** Example:2 with errors **
vi my-nginx-export.yaml

apiVersion: v1
kind: Pod
metadata:
name: my-nginx-export-pod
spec:
containers:
name: my-nginx-export-container
image: nginx:119

kubectl create -f my-nginx-export.yaml

kubectl get pod my-nginx-export-pod

kubectl edit pods my-nginx-export-pod

****** adding liveness probe.
spec:
containers:
image: nginx:1.19
imagePullPolicy: IfNotPresent
name: my-nginx-export-container
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: default-token-vfbjq
readOnly: true
livenessProbe:
httpGet:
path: /
port: 80
*********************************

kubectl get pod my-nginx-export-pod -o yaml # my-nginx-export2.yaml

kubectl delete pod my-nginx-export-pod --now

***** edit the pod specification and re-create the pod.
correct the nginx tag to 1.19 and also add liveness probe.
vi my-nginx-export2.yaml

spec:
containers:
image: nginx:1.19
imagePullPolicy: IfNotPresent
name: my-nginx-export-container
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: default-token-vfbjq
readOnly: true
livenessProbe:
httpGet:
path: /
port: 80
********************

kubectl apply -f my-nginx-export2.yaml
kubectl get pods


Watch video 13. Kubernetes Debugging online without registration, duration hours minute second in high quality. This video was added by user iMustLearn 23 July 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 7 once and liked it people.