Inspecting Your Deployment
Now that we've created a deployment, let's take a closer look at what Kubernetes has set up for us.
First, check the status of our deployment:
kubectl get deployments
You should see something like this:
NAME READY UP-TO-DATE AVAILABLE AGE
hello-kubernetes 1/1 1 1 2m
This output tells us:
READY
: 1/1 means one pod is ready out of one desired pod.
UP-TO-DATE
: 1 means one pod is running the latest configuration.
AVAILABLE
: 1 means one pod is available to serve traffic.
Next, let's look at the pods that our deployment has created:
kubectl get pods
You should see something like:
NAME READY STATUS RESTARTS AGE
hello-kubernetes-6b89d599b9-x7tpv 1/1 Running 0 3m
The exact pod name will be different, but you should see one pod with a status of "Running". This pod contains our NGINX container.
If you don't see a running pod, wait a minute and try again. Kubernetes might still be creating the pod or downloading the NGINX image.
To get more detailed information about our pod, run:
kubectl describe pod hello-kubernetes-6b89d599b9-x7tpv
Note: Replace hello-kubernetes-6b89d599b9-x7tpv
with the name of your pod as shown in the output of kubectl get pods
.
This command will output a lot of information. Don't worry about understanding all of it now. Key things to notice:
Status
: Should be "Running"
IP
: The pod's internal IP address
Containers
: Information about the NGINX container running in the pod
If you see any errors in this output, they can help diagnose issues with your pod.