<p>I have the following situation (this is my motivation to ask the question, not the question itself):</p>
<ul>
<li>I've got a web application that accepts uploads from users.
<ul>
<li>The users access the application through an Ingress,</li>
<li>then a Service,</li>
<li>Then a Deployment with two Pods.</li>
<li>Application contained in each Pod.</li>
</ul>
</li>
<li>Sometimes the upload fails:
<ul>
<li>I can see in the logs from the Pod that the upload went all right.</li>
<li>I can even see the data uploaded by the user.</li>
<li>There are nothing but normal logs in the Pod.</li>
<li>But the ingress reports a HTTP 500 error.</li>
<li>And the users sees a HTTP 500 error - connection reset by peer.</li>
</ul>
</li>
</ul>
<p>If the Pod seems all right, but ingress complains, then I should check the middle man, the Service. Then I realized that there is no easy way to obtain logs from the service.</p>
<p>So this is my question:</p>
<ul>
<li>How can I read logs from the Service object ? I mean activity logs, not the deployment events.</li>
<li>Do they exist?</li>
</ul>

jmgonet
<p>The only resources in K8s that produce logs are Pods! Pods lead to the creation of containers, which for their part lead to the creation of Linux processes on the K8s nodes. Those processes write logs that are &quot;reaped&quot; by the container runtime and made available to K8s, e.g. when you run <code>kubectl logs</code>.</p>
<p><strong>Consequently, only K8s resources that are backed by Pods produce logs, e.g. Deployment, Daemonsets, StatefulSets and Jobs.</strong></p>
<p>Services are merely logical resources that configures how network traffic can be routed to Pods. So, in a way they have underlying Pods, but do not produce any additional log output. The only tangible outcome of a Service resource are iptables rules on the K8s nodes, that define how traffic has to be routed from the Service IP to the IPs of the underlying Pods.</p>
<p>To resolve Ingress related problems, you might get further insights from the logs of your <a href="https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/" rel="nofollow noreferrer">ingress controller</a> which is typically deployed as a deployment and therefore backed by Pods.</p>
