No, you can't rely on that as an indicator of a successful run. That value changes whenever your CronJob runs. It doesn't mean that it's your last successful run and it doesn't change depending on exit codes.
A CronJob
essentially runs a Job
with a name that is <cronjob name>-<unix epoch>
. The epoch is in Unix/Linux what you would get from the date +%s
command, for example, also that epoch is a timestamp that is slightly later than the timestamp of the lastScheduleTime
(It's when the job resource gets created)
To find out if your last cron job ran successfully you can do something like the following.
You can get the last Job run/started name including its epoch with something like this:
$ kubectl get jobs | tail -1 | awk '{print $1}'
Then after that, you could check whether that job is successful with something like:
$ kubectl get job <job-name> -o=jsonpath='{.status.succeeded}'
Should return a 1
.