We start with application failures.
Let’s take a look at a two-tier application that has a web
and a database server.
The database pod hosts a database application
and serves the web servers through a database service.
The web server is hosted on a web pod
and serves users through the web service.
It’s good to write down or draw a map or chart
of how your application is configured before you start.
Depending on how much you know about the failure,
you may choose to start from either end of this map.
But remember to check every object and link in this map
until you find the root cause of the issue.
Say, in our case,
users report some issue with accessing the application.
First, we start with the application front end.
Use standard ways of testing
if your application is accessible.
If it’s a web application, check if the web server
is accessible on the IP of the node port using cURL.
Next, check the service.
Has it discovered endpoints for the web pod?
In this case, it did, but if it did not,
then you might want to check the service to pod discovery.
Compare the selectors configured on the service
to the ones on the pod.
Make sure that they match.
Next, check the pod itself
and make sure it is in a running state.
The status of the pod as well as the number of restarts
can give you an idea of whether the application
on the pod is running or is getting restarted.
Check the events related to the pod
using the described command.
Check the logs of the application using the logs command.
If the pod is restarting due to a failure,
then the logs in the current version of the pod
that’s running the current version of the container
may not reflect why it failed the last time.
So you either have to watch these logs
using the dash F option
and wait for the application to fail again,
or use the previous option to view the logs
of a previous pod.
Next, check the status of the DB service as before
and finally, check the DB pod itself.
Check the logs of the DB pod
and look for any errors in the database.
There are some more tips documented
in the Kubernetes documentation page
for troubleshooting applications.
This will help in upcoming practice test as well as
in the exam.