-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensures that images are pulled from the insecure registry with http #3161
Ensures that images are pulled from the insecure registry with http #3161
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: essobedo The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @essobedo! |
Hi @essobedo. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -36,6 +36,7 @@ metadata: | |||
data: | |||
localRegistryHosting.v1: | | |||
host: "localhost:${reg_port}" | |||
hostFromClusterNetwork: "${reg_name}:5000" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat!
Catching up after being on vacation for a week and some other kubernetes priorities ... Thanks for the PR! Unfortunately we can't merge anything without the CNCF's CLA 😅 |
@BenTheElder The CLA is signed now, it took me some time |
/ok-to-test |
@@ -25,7 +25,7 @@ The registry can be used like this. | |||
1. First we'll pull an image `docker pull gcr.io/google-samples/hello-app:1.0` | |||
2. Then we'll tag the image to use the local registry `docker tag gcr.io/google-samples/hello-app:1.0 localhost:5001/hello-app:1.0` | |||
3. Then we'll push it to the registry `docker push localhost:5001/hello-app:1.0` | |||
4. And now we can use the image `kubectl create deployment hello-server --image=localhost:5001/hello-app:1.0` | |||
4. And now we can use the image `kubectl create deployment hello-server --image=kind-registry:5000/hello-app:1.0` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is unrelated and localhost:5001 should work.
the goal is to ensure that a consistent name is used for the images across hosts to avoid confusion for users.
@@ -16,7 +16,7 @@ kind: Cluster | |||
apiVersion: kind.x-k8s.io/v1alpha4 | |||
containerdConfigPatches: | |||
- |- | |||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"] | |||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."${reg_name}:5000"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this configuration as-is allows us to remap pulls for images at localhost:$registry_port
to the registry container, for a consistent reference between host and nodes
you can remap anything to anything, this is remapping is performed in the image resolution code in containerd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so containerd sees localhost:5001/foo
and instead it pulls from the endpoint we specify here.
|
||
If you build your own image and tag it like `localhost:5001/image:foo` and then use | ||
it in kubernetes as `localhost:5001/image:foo`. And use it from inside of your cluster application as `kind-registry:5000`. | ||
it in kubernetes as `kind-registry:5000/image:foo`. And use it from inside of your cluster application as `kind-registry:5000`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here: this doesn't need to change. the only time you need to use kind-registry instead is if you're in the docker network and not using the node container runtime
looking at the config again now, they are not, it is configured as http
I think there may be some confusion here either about how the containerd feature works or about pulling images from something other than the node runtimes. |
I confirm that the current code works for the use case provided in the article https://kind.sigs.k8s.io/docs/user/local-registry/ but not in my use case where I need to be able to push an image from a pod with this approach we can access the local registry in the exact same manner inside the k8s cluster but I understand that it is probably too specific. |
To push from a pod you have to use kind-registry:$port and the docs mention this? That line may need clarifying, but doing that doesn't require altering the containerd configuration |
Related to #110
Motivation
Inside k8s, the images are pulled from the insecure registry using HTTPS while they should be pulled with HTTP.
Modifications:
kind-registry
are pulled using HTTPhostFromClusterNetwork
of thelocalRegistryHosting