On Fri, Aug 28, 2020 at 5:26 PM Luiz Carvalho <l...@redhat.com> wrote:

> Hello all,
>
> I'm digging through the docs and I don't see a way of creating a CronJob
> that uses an image from an ImageStream. Is this possible?
>

It is possible, but only if the imagestream resides in the same
project/namespace as your cronjob/pod:

https://docs.openshift.com/container-platform/3.11/dev_guide/managing_images.html#using-is-with-k8s

those are 3.11 docs but it works the same way in 4.x.  The difference in
4.x is the admin can't enable/disable/customize the behavior.

but i don't think you need this. see below.



>
> I'd like to use an ImageStream so I can use its cached version instead of
> hitting the registry everytime the pod starts. My understanding is that by
> doing so the image is stored in the cluster's internal docker registry.
> Thus, it shouldn't hit the registry even if it needs to be used by a pod on
> a different node. Is this assumption correct?
>

are you saying you want to avoid hitting the external registry (e.g.
docker.io or quay.io)?  If so, the imagestream will have no bearing on that.

What you want is pullthrough.
https://docs.openshift.com/container-platform/3.11/install_config/registry/extended_registry_configuration.html#middleware-repository-pullthrough

You can achieve pullthrough by:
1) defining the imagestream that points to the external registry
2) defining your cronjob to use a regular image pullspec which points to
the the imagestream, e.g.:
internalregistry.com/imagestreamnamespace/imagestreamname:imagestreamtag




>
> Thanks,
> Luiz
> _______________________________________________
> dev mailing list
> dev@lists.openshift.redhat.com
> http://lists.openshift.redhat.com/openshiftmm/listinfo/dev
>


-- 
Ben Parees | OpenShift
_______________________________________________
dev mailing list
dev@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/dev

Reply via email to