Hi,
I am in China, because of GFW, you can not pull images from k8s.gcr.io (google is banned).
Is there any solution that allows me to pull the images from the mirror GCR repo on docker.io ? for example hub.docker.com/u/googlecontainer
I found some solutions that you can use 'docker pull' to pull the images, then 'docker tag' to re-tag image to k8s.gcr.io namespace, but the problem is I have to pull and tag every time image updates, and the most important is microk8s.ctr image does not have 'tag' command.
I hear that some are using proxies. See the "Deploy behind a proxy" section in https://microk8s.io/docs/ on how to set MicroK8s with a proxy.
Hi @lostwater, maybe this can help.
To get your cluster working, you need to have your pause container using the registry that you can access from china. You can edit the /var/snap/microk8s/current/args/containerd-template.toml. You should be able to find the pause image there. After that you need to restart containerd snap.microk8s.daemon-containerd.
But for addons, unfortunately the yamls are mostly located in $SNAP, which is a readonly fs.
if i remember right, china have a registry where they get the images mirrored from gcr. And they use that to pull images. But that was sometime ago.
Hi @lostwater, maybe this can help.
To get your cluster working, you need to have yourpausecontainer using the registry that you can access from china. You can edit the/var/snap/microk8s/current/args/containerd-template.toml. You should be able to find thepauseimage there. After that you need to restart containerdsnap.microk8s.daemon-containerd.But for addons, unfortunately the yamls are mostly located in
$SNAP, which is a readonly fs.if i remember right, china have a registry where they get the images mirrored from gcr. And they use that to pull images. But that was sometime ago.
thanks, I have found the 'pause' yaml, of course, I can modify that file. but for addons, as you said, there are mirrors in China, but the namespace is different, how can i let microk8s use that images, since i can not re-tag images using micork8s.ctr
Would this https://github.com/ubuntu/microk8s/issues/396 work for you?
Would this #396 work for you?
I am not able to set a proxy server
@lostwater as already mentioned the yaml manifests for addons are on a read only file system. You could microk8s.enable "whatever_addons_you_need" and as soon as you see them failing to pull the images edit the respective deployments so they point to the right repository. Do amicrok8s.kubectl edit "failing_deployment"` and you should see the reference to the images under the containers section.
Of course this requires you edit all yamls by hand. Unfortunately we do not have a single place to change all image references.
@ktsakalozos thanks very much, but I ended up with setting up a proxy server. I do not want to edit each yaml every time I deploy microk8s. please consider supporting custom image namespace, for example, I have a mirror docker.io/mirrorgooglecontainers/ = k8s.gcr/
Thank you for the suggestion @lostwater. I am going t leave this issue open and mark it as a feature request.
@ktsakalozos I running a http-proxy listen 8118 locally, and set HTTPS_PROXY=http://127.0.0.1:8118 in /var/snap/microk8s/current/args/containerd-env and restart snap.microk8s.daemon-containerd, but no effect on pull any images.
I tried again and again, but couldn't execute microk8s.enable dns correctly. The status of coredns-f7867545d-qxxdq always is pending.
So I doubt this proxy setting.
@lostwater hey man I'm a cuban and I am dealing with the same problem even docker.io it is blocked to us so I bring a tor proxy with me just apt install tor and I changed the the file /var/snap/microk8s/current/args/containerd-env to use the tor proxy
happy coding
@ktsakalozos Thank you for your work. Maybe we can add a flag just like kubeadm did.
kubeadm init --image-repository=gcr.azk8s.cn/google_containers
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
@ktsakalozos Thank you for your work. Maybe we can add a flag just like
kubeadmdid.