Kubernetes basic pod logging

6/7/2019

Hi I'm trying to setup basic logging to get all my pod logs at a single place. Following is the pod-spec I have created but couldn't find the trace of the logs in the location mentioned. What could be missing in the template below?

    apiVersion: v1
    kind: Pod
    metadata:
      name: counter
    spec:
      containers:
    - name: count
        image: busybox
        args: [/bin/sh, -c,
        'i=0; while true; do echo "$i: $(date)" >> /u01/kubernetes_prac/logs/log_output.txt; i=$((i+1)); sleep 1; done']
        volumeMounts:
        - name: varlog
          mountPath: /u01/kubernetes_prac/logs
      volumes:
      - name: varlog
        emptyDir: {}
-- Avi
kubernetes

2 Answers

6/15/2019

Look into fluentd , to save ur logs somewhere(s3, elastic etc)

-- Sergio Teixeira
Source: StackOverflow

6/7/2019

try this:

volumes:
  - name: varlog
    hostPath:
      path: /tmp/logs

and check the node logs on that location

-- Sergio Teixeira
Source: StackOverflow