Goal:
- create a Pod without a descriptor
- troubleshoot a Pod's start
- Display the help for the
kubectl run
command:
kubectl run --help
- Launch the following command to start a Pod
kubectl run whoami --image=traefik/whoami:v1.10 --port=80
It will:
- start a
whoami
Pod - from the
traefik/whoami:v1.10
image - and reference the
80
port - Check the Pod start with
watch kubectl get po
(ctrl+c to exit the watch loop) - What can you see?
- Display more details on the Pod with
kubectl describe
and get its IP address which you will need later - Check that the application is working with the following command:
# We have to enter in a node of the cluster
minikube ssh -- curl <ip-du-pod-whoami>:80/api
- Launch the following command to start a new Pod
kubectl run faulty-whoami --image=traefik/whoami:nil --port=80
It will:
- start a Pod (we will cover the Pod's detail later)
- with the name
faulty-whoami
- from the image
traefik/whoami:nil
- and reference the
80
port - Check the Pod's startup with
watch kubectl get po
(ctrl+c to exit the watch loop) - Check that the Pod fails to start
- Display more info on the Pod and check the
Events
withkubectl describe
to determine the error cause - Delete this Pod with
kubectl delete pod faulty-whoami
- Launch the following command to start a new Pod
kubectl run training-shell --image=zenika/k8s-training-tools:v5 --command -- sleep infinity
It will:
- start a
training-shell
Pod - from the image
zenika/k8s-training-tools:v5
- whose main process will be
sleep infinity
- Check the Pod's startup
- List all created Pods
- Launch
kubectl exec training-shell -- curl -s <ip-du-pod-whoami>:80/api
- Display the help for
kubectl exec
K9s
is a TUI ("Text User Interface") used to browse Kubernetes resources without kubectl
commands.
- Launch
k9s
to find the created Pod and browse the interface. The keyboard shortcuts are displayed on top of the screen. UseCTRL+C
to exit.