Use kubectl
to
pod
using image ‘sirfragalot/docker-demo:dcus’ called lab1
pod
Which node is this pod running on?
kubectl run lab1 --image=sirfragalot/docker-demo:dcus
kubectl describe pod lab1
kubectl get event | grep lab1
kubectl get event --field-selector involvedObject.name=lab1
curl 192.168.43.1:8080 (get the IP from the describe above)
kubectl port-forward lab1 8989:8080
(then: curl localhost:8989)
kubectl get pod --field-selector=metadata.name=lab1 -o wide
Use kubectl
to
pod
called ’nginx’ with the nginx imageUse kubectl
to create a new pod with the name redis
and with the image redis:1.99
.
Identify the problem with the pod.
Rectify the problem with the pod and wait until the pod is ready and healthy.
kubectl run redis --image=redis:1.99
# notice the ImagePullBackoff error
kubectl get pod redis
# observe the Events section for errors
kubectl describe pod redis
# in kubernetes 1.23 you can do 'get' on events to observe just the namespace events
kubectl get events
# resolve the issue - there are other ways - edit command or edit yaml,but this is quickest, change the image for the container in the pod
# fix redis pod using redis image (lastest image - bad in prodution)
kubectl set image pod/redis redis=redis
kubectl get pods
Use kubectl
to
my-nginx
and expose it on container port 8080
.kubectl run my-nginx --image=nginx --port=8080
kubectl describe pod my-nginx