Kubernetes cron job needs to get tag from prod rather than latest?

You can create git release tags or use commit ids. Put this value in config map, and the cron job container should pull code by using this commit-id or release tag. So staging and production configs can have a different tags.

I would not recommend using latest tag for deployments on kubernetes. It works well with docker but not with kubernetes + docker. Create immutable image tags. Kuberentes compares only tag, not tag + SHA. https://discuss.kubernetes.io/t/use-latest-image-tag-to-update-a-deployment/2929

Or you can use imagePullPolicy: always with latest tag.


Generally you should set up two Git repos of your application, for example master and prod. You may then use Jenkins to build and deploy those repose to Kubernetes on commit (prod branch can be set to build on demand). So master branch will push to latest tag, and prod branch will push to prod branch. Then you specify tag latest in your job manifest. That's how it is configured in most cases.

Any questions?

Tags:

Kubernetes