Assume I have a Kubernetes CronJob
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: cron-job-logging
spec:
schedule: "@hourly"
jobTemplate:
spec:
template:
spec:
containers:
- name: cron-job-logging
image: python:3
args:
- /usr/bin/python3
- -c
- import random; print('a') if random.random() < 0.5 else print('b')
restartPolicy: OnFailure
which runs on a GKE cluster 1.14.x with Cloud Operation for GKE activated for "System and workload logging and monitoring".
How can I collect the output for period t (let's say a month) so that I can see whether the pod printed a
or b
.
If seen some issues about this request, like https://github.com/kubernetes/kubernetes/issues/27768. The logs seem to be available for some users, but not for others which might be caused by the fact that CronJobs
are a beta feature.