<p>I'm running a Ruby app on Kubernetes with Minikube. </p>

<p>However, whenever I look at the logs I don't see the output I would have seen in my terminal when running the app locally.</p>

<p>I presume it's because it only shows stderr?</p>

<p>What can I do to see all types of console logs (e.g. from <code>puts</code> or <code>raise</code>)?</p>

<p>On looking around is this something to do with it being in detached mode - see the Python related issue: <a href="https://stackoverflow.com/questions/43969743/logs-in-kubernetes-pod-not-showing-up">Logs in Kubernetes Pod not showing up</a></p>

<p>Thanks.</p>

<p>=</p>

<p>As requested - here is the deployment.yaml</p>

<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: sample
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: sample
    spec:
      containers:
        - name: sample
          image: someregistry
          imagePullPolicy: Always
          command: ["/bin/sh","-c"]
          args: ["bundle exec rake sample:default --trace"]
          envFrom:
          - configMapRef:
              name: sample
          - secretRef:
              name: sample
          ports:
            - containerPort: 3000
      imagePullSecrets:
        - name: regsecret
</code></pre>

<p>As shown in this article, <code>kubectl logs pod apod</code> should show you stdout and stderr for a pod deployed in a minikube.</p>

<blockquote>
  <p>By default in Kubernetes, Docker is configured to write a container's stdout and stderr to a file under /var/log/containers on the host system</p>
</blockquote>

<p><a href="https://kubernetes.io/docs/concepts/cluster-administration/logging/#system-component-logs" rel="noreferrer">Kubernetes adds</a>:</p>

<blockquote>
  <p>There are two types of system components: those that run in a container and those that do not run in a container.<br>
  For example:</p>
  
  <ul>
  <li>The Kubernetes scheduler and kube-proxy run in a container.</li>
  <li>The kubelet and container runtime, for example Docker, do not run in containers.</li>
  </ul>
</blockquote>

<p>And:</p>

<blockquote>
  <ul>
  <li>On machines with systemd, the kubelet and container runtime write to journald. </li>
  <li>If systemd is not present, they write to <code>.log</code> files in the <code>/var/log</code> directory.</li>
  </ul>
  
  <p>Similarly to the container logs, system component logs in the /var/log directory should be rotated.<br>
  In Kubernetes clusters brought up by the kube-up.sh script, those logs are configured to be rotated by the logrotate tool daily or once the size exceeds 100MB.</p>
</blockquote>

<p><a href="https://i.stack.imgur.com/JzhOm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JzhOm.png" alt="https://d33wubrfki0l68.cloudfront.net/59b1aae2adcfe4f06270b99a2789012ed64bec1f/4d0ad/images/docs/user-guide/logging/logging-node-level.png"></a></p>
