Skip to main content
Version: 1.48

Inspect your application in Kubernetes

Your application runs on Kubernetes, so you can inspect it with kubectl like any other Kubernetes application: its pods, their logs, and the events of your Namespace. Come back to this page at any step of the series when something doesn't work.

This page uses the Movies app, deployed with okteto deploy as described in Deploy.

First, configure kubectl with the credentials and the Namespace of your Okteto Context:

okteto kubeconfig
✓ Updated kubernetes context 'okteto_example_com/cindy' in '/Users/cindy/.kube/config'

The commands on this page only read the state of your Namespace: they don't change anything in it.

List the pods of the application. The seed job runs once per deployment and stays Completed:

kubectl get pods
NAME READY STATUS RESTARTS AGE
api-75cb79d67f-zjvr8 1/1 Running 0 62s
frontend-7c9d54574-mnd7k 1/1 Running 0 62s
mongodb-5db5b9d9b-ztnl5 1/1 Running 0 62s
seed-wdgmc 0/1 Completed 0 62s

Check the logs of the api service, which prints a line for every request it gets:

kubectl logs deploy/api
Server running on port 8080.
GET /api/movies
GET /api/watching

List the events of your Namespace, with the most recent ones last:

kubectl get events --sort-by=.lastTimestamp
LAST SEEN TYPE REASON OBJECT MESSAGE
...
65s Normal ScalingReplicaSet deployment/api Scaled up replica set api-75cb79d67f from 0 to 1
63s Normal Started pod/api-75cb79d67f-zjvr8 Container started
55s Normal Pulled pod/mongodb-5db5b9d9b-ztnl5 Successfully pulled image "mongo:9.0.8" in 107ms (107ms including waiting). Image size: 393136372 bytes.
52s Warning Unhealthy pod/mongodb-5db5b9d9b-ztnl5 Readiness probe failed: dial tcp 10.8.2.88:27017: connect: connection refused
38s Normal Completed job/seed Job completed

The Unhealthy warning for mongodb is expected: MongoDB only listens on the IP of its pod after its init script creates the okteto user, and until then its readiness probe keeps it out of its Service. When a pod doesn't start, its events tell you why, for example an image that can't be pulled or a failing probe.

An AI agent with the Okteto agent skills runs these same read-only commands to find out why a service doesn't start or a test fails.

Now you know how to look inside your Namespace. In the next step, test the Movies app against its endpoints with Okteto Test.