<p>How to check API access log in kubernetes.
I have an application with two pods. I want to see the access logs how it is getting distributed.</p>

Pthota
<p>The answer depends on your architecture. Unfortunately, the question is not complete, so we can provide only general info here. </p>

<p>The common way <a href="https://kubernetes.io/docs/concepts/cluster-administration/logging/" rel="nofollow noreferrer">acessing logs</a> in Kubernetes is through <code>kubectl logs &lt;pod_name&gt;</code> command. That'll give you logs for the first container on that Pod. It's needed to specify particular container name if you are running some side-car containers there.</p>

<pre><code>kubectl get pods
NAME                           READY   STATUS
nginx-65f88748fd-scxzl         1/1     Running

kubectl logs nginx-65f88748fd-scxzl
&lt;Nginx Logs from my pod&gt;
</code></pre>

<p>Additionally (if your app supports internal logging) it is possible to connect to the Pod in interactive mode and run some command directly on pod (if supported).</p>

<p><code>kubectl exec &lt;parameters&gt; &lt;pod_name&gt; -- &lt;command&gt;</code></p>

<p>For example you can run some shell on Pod and check logs.</p>

<pre><code>kubectl exec -it nginx-65f88748fd-scxzl -- bash
root@nginx-65f88748fd-scxzl:/# 
</code></pre>

<p><code>-it</code> initiates connection in interactive mode and command to run is placed after <code>--</code> .</p>

<p>Hope that helps.</p>
