Skip to content

Instantly share code, notes, and snippets.

@nilesh93
Created October 15, 2020 09:26
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nilesh93/0183d4ecbbd9ae42549d2e5f1b830ac7 to your computer and use it in GitHub Desktop.
Pod Sidecar Log Stream Example
apiVersion: v1
kind: Pod
metadata:
name: counter
spec:
containers:
- name: date
image: busybox
args:
- /bin/sh
- -c
- >
i=0;
while true;
do
echo "$i: $(date)" >> /var/log/date.log;
i=$((i+1));
sleep 1;
done
volumeMounts:
- name: varlog
mountPath: /var/log
- name: date-log-stream
image: busybox
args: [/bin/sh, -c, 'tail -n+1 -f /var/log/date.log']
volumeMounts:
- name: varlog
mountPath: /var/log
volumes:
- name: varlog
emptyDir: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment