In Kubernetes, pod and deployment logs that are related to how pods and containers are scheduled can be accessed through the kubectl logs command, but not all application logs and commands are exposed through Kubernetes APIs. Getting access to these logs and shell commands inside a container may be required.
In this section, we will learn how to access a container shell, extract logs, and update binaries for troubleshooting.
Getting ready
Clone the k8sdevopscookbook/src repository to your workstation to use the manifest files under the chapter10 directory, as follows:
$ git clone https://github.com/k8sdevopscookbook/src.git
$ cd src/chapter10
Make sure you have a Kubernetes cluster ready and kubectl configured to manage the cluster resources.
How to do it…
This section is further divided into the following subsections to make this process easier:
- Getting shell access in a container
- Accessing PostgreSQL logs inside a container