Skip to content
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

update registry addon documentation #6982

Open
tliron opened this issue Mar 10, 2020 · 28 comments
Open

update registry addon documentation #6982

tliron opened this issue Mar 10, 2020 · 28 comments
Labels
area/registry registry related issues co/runtime/crio CRIO related issues help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/documentation Categorizes issue or PR as related to documentation. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@tliron
Copy link

tliron commented Mar 10, 2020

The exact command to reproduce the issue:

minikube start --addons=registry --container-runtime=cri-o

The full output of the command that failed:

Pods fail to pull image from the registry, e.g.:

image: localhost:5000/mycontainer

Note that I can push to the registry from outside via docker://$(minikube ip):5000/mycontainer.

Switching to Docker runtime allows this to work.

The operating system version:

Fedora 31

@afbjorklund
Copy link
Collaborator

You are saying that the registry works with --container-runtime=docker, but not with --container-runtime=cri-o ? (the above command-line is more talking about CNI options, rather than CRI...)

From the outside, it is normally more like: https://minikube.sigs.k8s.io/docs/tasks/docker_registry/

@afbjorklund afbjorklund added co/runtime/crio CRIO related issues area/registry registry related issues kind/support Categorizes issue or PR as a support question. labels Mar 10, 2020
@tliron
Copy link
Author

tliron commented Mar 10, 2020

Ugh, so sorry, did a wrong copy and paste. Will edit the original issue,

@afbjorklund afbjorklund added kind/bug Categorizes issue or PR as related to a bug. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. and removed kind/support Categorizes issue or PR as a support question. labels Mar 10, 2020
@afbjorklund
Copy link
Collaborator

Do you have the error output, like if you do a describe pod on it ?

@tliron
Copy link
Author

tliron commented Mar 10, 2020

These are the events:

16s         Normal    Pulling             pod/mycontainer-f7dcbd7f6-tx9nc    Pulling image "localhost:5000/mycontainer"
28s         Warning   Failed              pod/mycontainer-f7dcbd7f6-tx9nc    Failed to pull image "localhost:5000/mycontainer": rpc error: code = Unknown desc = error pinging docker registry localhost:5000: Get http://localhost:5000/v2/: dial tcp 127.0.0.1:5000: i/o timeout

Nothing much more in describe, just the fail reason being ImagePullBackOff.

@afbjorklund
Copy link
Collaborator

There doesn't seem to be anything in the registry logs, so I guess it is getting stuck in registry-proxy

It works from the outside, but just hangs from the inside. Even with curl, so something is wrong...

The internal IP are fine:

$ curl http://10.1.0.2:5000/v2/
{}$ 
$ curl http://10.1.0.3:80/v2/
{}$ 

But not the localhost.

$ curl http://192.168.99.100:5000/v2/
{}$ 
$ curl http://localhost:5000/v2/
curl: (7) Failed to connect to localhost port 5000: Connection timed out

@afbjorklund
Copy link
Collaborator

Looks similar to cri-o/cri-o#1804

@tliron
Copy link
Author

tliron commented Mar 10, 2020

Thank you for verifying. Any ideas of a temporary workaround?

@afbjorklund
Copy link
Collaborator

afbjorklund commented Mar 10, 2020

Note that it has to be localhost, since that is the hack used to get an insecure registry...

Failed to pull image "192.168.99.100:5000/test-img": rpc error: code = Unknown desc = error pinging docker registry 192.168.99.100:5000: Get https://192.168.99.100:5000/v2/: http: server gave HTTP response to HTTPS client

The workaround is configuring the minikube IP as an insecure registry, in the crio.conf

# List of registries to skip TLS verification for pulling images. Please   
# consider configuring the registries via /etc/containers/registries.conf before
# changing them here.                                                          
#insecure_registries = "[]"                                                      

EDIT: Apparently we are using /etc/containers/registry.conf for this as well, so:

[registries.search]
registries = ['docker.io']

[registries.insecure]
registries = ['192.168.99.100:5000']                                   

This would be for the track where you use the IP instead of the localhost proxy:

kubectl run test-img --image=$(minikube ip):5000/test-img


Or deploy a proper https registry (left as an exercise for the reader :-) )

https://docs.docker.com/registry/deploying/#run-an-externally-accessible-registry

Instead of the horrible hack, that is the kubernetes registry-proxy container...

kubernetes/kubernetes@d6918bb

The private registry runs as a Pod in your cluster. It does not currently support SSL or authentication, which triggers Docker's "insecure registry" logic. To work around this, we run a proxy on each node in the cluster, exposing a port onto the node (via a hostPort), which Docker accepts as "secure", since it is accessed by localhost.

@afbjorklund afbjorklund added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels Mar 10, 2020
@tliron
Copy link
Author

tliron commented Mar 10, 2020

Hm, so it looks like cri-o doesn't support Docker's "localhost is allowed as an insecure registry" hack? If that's the case, I think it should be documented that the registry addon doesn't work with cri-o, at least this time.

@afbjorklund
Copy link
Collaborator

Yeah, it seems like hostPort has some issues with cri-o and that should probably be documented...

@afbjorklund
Copy link
Collaborator

Hm, so it looks like cri-o doesn't support Docker's "localhost is allowed as an insecure registry" hack?

That part is supported just fine, since it tries to be bug-compatible at least for the docker:// protocol

@tliron
Copy link
Author

tliron commented Mar 10, 2020

I found a simple workaround. Get the registry service's cluster IP:

kubectl get svc registry --output=jsonpath='{.spec.clusterIP}' --namespace=kube-system

And then use that address, with port 80, for the image URL, e.g.:

image: 10.102.27.206:80/mycontainer

@priyawadhwa priyawadhwa added kind/documentation Categorizes issue or PR as related to documentation. needs-solution-message Issues where where offering a solution for an error would be helpful labels Mar 25, 2020
@priyawadhwa
Copy link

Hey @tliron awesome. We should update the documentation to include that workaround when trying to use the registry addon with cri-o.

@tliron
Copy link
Author

tliron commented Mar 26, 2020

@priyawadhwa Thanks, but it's an awkward solution. The problem is that users would have to update all their specs to use this varying IP address. I hope we can find a way to enable localhost:5000 for CRI-O (which, we hope, will become minikube's default runtime).

@tstromberg tstromberg removed the needs-solution-message Issues where where offering a solution for an error would be helpful label Apr 2, 2020
@tliron
Copy link
Author

tliron commented Apr 3, 2020

Here is a version of my workaround above in Go code:

import (
	"context"
	"fmt"
	meta "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes" // v0.18.0
)

func GetInternalRegistryURL(kubernetesClient *kubernetes.Clientset) (string, error) {
	if service, err := kubernetesClient.CoreV1().Services("kube-system").Get(context.TODO(), "registry", meta.GetOptions{}); err == nil {
		return fmt.Sprintf("%s:80", service.Spec.ClusterIP), nil
	} else {
		return "", err
	}
}

@charandas
Copy link

The same thing happens with ingress addon. No go with cri-o runtime. The minikube ip does not host any loadbalancer, and it fails silently, while internally, the ingress objects bind to minikube ip just fine.

@medyagh
Copy link
Member

medyagh commented May 13, 2020

I would be happy to review any PR that fixes this for CRI-O

@medyagh medyagh added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label May 13, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 11, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 10, 2020
@CtrlZvi
Copy link

CtrlZvi commented Sep 30, 2020

/remove-lifecycle rotten
To the best of my knowledge, this is still a valid issue.

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Sep 30, 2020
@sharifelgamal sharifelgamal added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Sep 30, 2020
@tliron
Copy link
Author

tliron commented Oct 19, 2020

I think an acceptable solution is to document this in Minikube, probably here. To be honest, that whole page could use a rewrite, as it's more a collection of notes than a guide. As it stands right now, the only way to really learn what --addons=registry does is to look at blogs.

I'd like to help, but I'm unfamiliar with the project interactions. Could someone who knows please take responsibility for resolving this issue?

@sharifelgamal sharifelgamal removed the kind/bug Categorizes issue or PR as related to a bug. label Mar 17, 2021
@medyagh
Copy link
Member

medyagh commented Apr 14, 2021

I think an acceptable solution is to document this in Minikube, probably here. To be honest, that whole page could use a rewrite, as it's more a collection of notes than a guide. As it stands right now, the only way to really learn what --addons=registry does is to look at blogs.

I'd like to help, but I'm unfamiliar with the project interactions. Could someone who knows please take responsibility for resolving this issue?

I agree with you @tliron that page is getting very messy and hard to read, I would accept a PR that organizes that page on our webiste and makes it easier to read

@medyagh medyagh changed the title Registry addon cannot be accessed internally when using cri-o runtime update registry addon documentaiton Apr 14, 2021
@tliron
Copy link
Author

tliron commented Apr 14, 2021

It sounds like I'm being volunteered. :) I may try to take a stab at it if I can find the time.

It's all very hard, to be honest. The challenge is not just to allow Kubernetes's container runtime access to the private registry (with authentication? authorization?) but also how a user/developer can access it push images to it. After all, that is the goal of having such a built-in registry in the first place. None of this work is trivial. But at least it can be documented specifically for Minikube, which does have some advantages in that it can run in "insecure" mode (self-signed cert).

On that note, I ended up creating a generic solution to the problem of handling and working with private registries, a project I call Reposure. Reposure has explicit support for Minikube's registry add-on.

@ilya-zuyev ilya-zuyev removed the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Apr 21, 2021
@medyagh
Copy link
Member

medyagh commented Apr 28, 2021

It sounds like I'm being volunteered. :) I may try to take a stab at it if I can find the time.

It's all very hard, to be honest. The challenge is not just to allow Kubernetes's container runtime access to the private registry (with authentication? authorization?) but also how a user/developer can access it push images to it. After all, that is the goal of having such a built-in registry in the first place. None of this work is trivial. But at least it can be documented specifically for Minikube, which does have some advantages in that it can run in "insecure" mode (self-signed cert).

On that note, I ended up creating a generic solution to the problem of handling and working with private registries, a project I call Reposure. Reposure has explicit support for Minikube's registry add-on.

@tliron thank you That does sounds like a good idea to update our docs and maybe refactor our docs on registry addon with better examples and better categorization

@k8s-triage-robot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 27, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 26, 2021
@sharifelgamal sharifelgamal removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Sep 8, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 7, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 6, 2022
@sharifelgamal sharifelgamal changed the title update registry addon documentaiton update registry addon documentation Jan 12, 2022
@sharifelgamal sharifelgamal added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/registry registry related issues co/runtime/crio CRIO related issues help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/documentation Categorizes issue or PR as related to documentation. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests