How to add k8s.gcr.io as docker proxy?

Hi,

I should state that my objective is to store a cache of the images then I can bring my Nexus to offline environment where my offline machine can pull from Nexus when Docker Kubernetes is enabled.


Thanks for that. I have setup the gcr proxy as per your instruction.

I was trying to pull as per normal so that my Nexus would have a cache copy… Let me try to explain what I am doing.

This is my current repo images.

image

*Sorry, forgot to expand the directory to show the before state but there isn’t rocket.chat in there`

If I try to pull rocket.chat image, without specifying anything special, rocket.chat image will be stored inside my Nexus.

image

As seen in the image below

However, if I try to do a docker pull k8s.gcr.io/kube-scheduler-amd64:v1.10.11, the image is downloaded on my machine but there is no cache copy of k8s.gcr.io/kube-scheduler-amd64 inside Nexus.

image
image

My local machine, there will be the kube-scheduler-amd64 image.

Now I rm the local kube-scheduler-amd64 image, then i try this. It doesn’t work.

Then I remove the k8s.gcr.io as the prefix. and run as per your command docker pull <my-ip>:<port>/kube-scheduler-amd64:v1.10.11. It works.

And now it will appear in my Nexus.

image


So the problem I am facing is that when I enable Kubernetes for Docker (Windows), it will auto download the images from k8s.gcr.io I suppose.

So the if I perform docker images, you will see the images as such.

Images started with k8s.gcr.io are pulled automatically when I enable Kubernetes for Docker (Windows).

kuber-controller-manager.amd64 and kube-scheduler-amd64 are pulled by myself with a cache in Nexus.

So if I port this to a offline machine, and then I try to enable Kubernetes for Docker, I would suppose that it will try to look for k8s.gcr.io/<imagename> rather than <myownhost>:<port>/<imagename> right? In that case, how can I achieve what I want to do? To allow Docker/Kubernetes to redirect the pull from Nexus. I understand that it probably not Nexus problem, but I am trying to understand the prefix thingy.

I think in short, you could say that… I’m also confused if it should be configuring Kubernetes or Docker to redirect the request to Nexus. However, even if I redirect, the prefix will not be starting with k8s.gcr.io

If any part is not clear, please let me know and I will try my best to clarify.

Thank you.