Skip to content
This repository has been archived by the owner on Jul 28, 2019. It is now read-only.

Add possibility for the local host to act as repository. #56

Closed
wederbrand opened this issue Dec 14, 2017 · 11 comments
Closed

Add possibility for the local host to act as repository. #56

wederbrand opened this issue Dec 14, 2017 · 11 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@wederbrand
Copy link

Basically the goal is to replace minikube with this. Minikube is cpu and memory intensive and has only one master node and no workers.

The dind-approach is by far better, just not as mature.

On thing that doesn't work (or I found no way of doing it) is to build images locally without pushing them to any repository and the use them in the dind-cluster.

That would be awesome.

@pigmej
Copy link
Contributor

pigmej commented Dec 14, 2017

It's docker in docker so you may use:
docker save {your_image} | docker exec -i {target_node} docker load

where target_node is the node where you need your image (you can have script that does it automatically on all nodes)

@wrecklass
Copy link

Handy work around, but it's not very kube-like. There should be a way to specify the repository as the local docker repo to mimic a standard workflow.

@ivan4th
Copy link
Contributor

ivan4th commented Dec 22, 2017

Problem is that if you're using multiple nodes, you'll have to use some kind of docker repo, probably local one, and push images there. So are you asking about hints how to make DIND work with local docker image repository? Other possibility is to make a single-node cluster and use it's inner docker engine to build images etc. I can also give some hints how to do it if you want

@wrecklass
Copy link

I think what were looking for is a way to do:

kubectl run myapp --image myapp:v3

And have it pull the image from the local host system Docker repository, rather than Docker Hub. Which wouldn't seem that hard to arrange. Minikube seems to manages to do this.

@wederbrand
Copy link
Author

wederbrand commented Dec 22, 2017

All I need to do is docker build -t myapp:v3 . and have it be accessible inside my cluster.

Minikube solves this by directing DOCKER_HOST to minikube's local repository.

A single node DIND-cluster would work perfect, actually, running just the master, untainted, as in minikube would be a good-enough replacement for minikube (mainly what I'm after)

@prosegay
Copy link

I'm a kubernetes/kubeadm-dind newbie. I'm running multiple nodes on osx and this (docker build -t ...) doesn't work for me. when i run kubectl run --image foo it fails on can't find "library/foo" in the pod. I found dind::copy-image and it distributed the image, but still not able to find it.

@diafour
Copy link

diafour commented May 8, 2018

It would be great to serve a registry from local /var/lib/docker but can't find such a solution.

So a simple workaround:

  1. Run registry in docker on your host:
$ docker run -d -p 5000:5000 --restart=always --name registry registry:2

Now localhost:5000 is a registry url.

$ docker tag alpine:3.6 localhost:5000/alpine:3.6                                        
$ docker push localhost:5000/alpine:3.6     
...
3.6: digest: sha256:d6eda1410b93902ac84bdd775167c84ab59e5abadad88791d742fea93b161e93 size: 528
  1. Run a proxy to forward each node's localhost:5000 to host's :5000 with a simple script:
  docker ps -a -q --filter=label=mirantis.kubeadm_dind_cluster | while read container_id; do
    docker exec ${container_id} /bin/bash -c "docker rm -fv registry-proxy || true"
    # run registry proxy: forward from localhost:5000 on each node to host:5000
    docker exec ${container_id} /bin/bash -c \
      "docker run --name registry-proxy -d -e LISTEN=':5000' -e TALK=\"\$(/sbin/ip route|awk '/default/ { print \$3 }'):5000\" -p 5000:5000 tecnativa/tcp-proxy"
  done

docs: https://hub.docker.com/r/tecnativa/tcp-proxy/

/sbin/ip route|awk '/default/ { print $3 }' is to get host's IP accessible from node container.

  1. Test it:
$ kubectl run test --image=localhost:5000/alpine:3.6 -ti /bin/ash             
If you don't see a command prompt, try pressing enter.
/ #

The trick is that 127.0.0.0/8 network is in insecure registries by default. No need to init cluster with DIND_INSECURE_REGISTRIES variable and to edit /etc/docker/daemon.json.

@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 Apr 23, 2019
@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 May 23, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

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

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

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

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

8 participants