Debugging applications in Kubernetes
As you start using Kubernetes to run various applications, you’ll eventually face the need to debug at least some of them. Sometimes, an application might have a bug that causes it to crash – maybe it was misconfigured or misbehaving under certain scenarios. Kubernetes provides multiple mechanisms that help us figure out what is wrong with the containerized payload and individual pod containers, including the following:
- Fetching logs from all containers in a pod, and also logs from the previous pod run
- Querying events that happened in a cluster recently
- Port forwarding from a pod to a local environment
- Running arbitrary commands inside containers of a pod
Logs play a crucial role and are very helpful to understand what is not working as intended. Applications often support multiple log levels categorized by the severity and verbosity of information that gets recorded, such as received requests and their payload...