cloud-agility / board

0 stars 0 forks source link

Investigate running a local docker registry in minikube to see if this would be easier than ICp #17

Open chrisesharp opened 6 years ago

chrisesharp commented 6 years ago

Not getting ICp registry working properly - still doesn't seem to work on the image pulls.

Following instructions at https://blog.hasura.io/sharing-a-local-registry-for-minikube-37c7240d0615 and using the yaml from https://gist.github.com/coco98/b750b3debc6d517308596c248daf3bb1 I can't get the docker registry to work in minikube.

Getting it working would be nice because we can have a consistent workflow between minikube, ICp and bluemix by having a docker push involved in each option.

chrisesharp commented 6 years ago

BTW, I have successfully instantiated the registry because I could do the following:

$ minikube ssh
                         _             _            
            _         _ ( )           ( )           
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __  
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

$ docker images
REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
gcr.io/google_containers/nginx-ingress-controller      0.9.0-beta.12       091ec63a2173        7 weeks ago         118.4 MB
gcr.io/google_containers/kubernetes-dashboard-amd64    v1.6.3              691a82db1ecd        12 weeks ago        139 MB
gcr.io/google_containers/k8s-dns-sidecar-amd64         1.14.4              38bac66034a6        4 months ago        41.81 MB
gcr.io/google_containers/k8s-dns-kube-dns-amd64        1.14.4              a8e00546bcf3        4 months ago        49.38 MB
gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64   1.14.4              f7f45b9cb733        4 months ago        41.41 MB
gcr.io/google-containers/kube-addon-manager            v6.4-beta.2         0a951668696f        4 months ago        79.23 MB
gcr.io/google_containers/kube-registry-proxy           0.4                 60dc18151daf        9 months ago        188.2 MB
registry                                               2.5.1               182810e6ba8c        10 months ago       37.6 MB
gcr.io/google_containers/pause-amd64                   3.0                 99e59f495ffa        17 months ago       746.9 kB
gcr.io/google_containers/defaultbackend                1.0                 137a07dfd084        2 years ago         7.51 MB
$ docker pull node:slim    
slim: Pulling from library/node
85b1f47fba49: Pull complete 
5409e9a7fa9e: Pull complete 
e1fbf5f3bc23: Pull complete 
82fc4577de57: Pull complete 
4e7bf57a240e: Pull complete 
fd849600b484: Pull complete 
Digest: sha256:f4d52fd0dbee88112b5a03e9572192e33f37291ff02285b25be4931f1a182219
Status: Downloaded newer image for node:slim
$ docker images
REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
node                                                   slim                6f0f198bbbc9        13 days ago         227.1 MB
...snip...

$ docker tag node:slim localhost:5000/node:slim
$ docker images
REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
localhost:5000/node                                    slim                6f0f198bbbc9        13 days ago         227.1 MB
node                                                   slim                6f0f198bbbc9        13 days ago         227.1 MB
...snip...

$ docker push localhost:5000/node:slim  
The push refers to a repository [localhost:5000/node]
7b573b0c4e95: Pushed 
c1992600fb32: Pushed 
a5f9c85f6b8a: Pushed 
773cb6e20146: Pushed 
d5d60fc34309: Pushed 
c01c63c6823d: Pushing [==================================================>] 129.3 MB
...

so, I know that the registry is working with the minikube VM, at least.

In the minikube ssh if I try to curl on the registry I get this:

$ minikube ssh
                         _             _            
            _         _ ( )           ( )           
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __  
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

$ curl http://localhost:5000/v2/
{}$ 

and if I do the port forwarding, I get the same response from my regular shell... however, when I do the docker push I get this...

dhcp-9-20-195-66:sample_node_app chrissharp$ curl http://localhost:5000/v2/
{}dhcp-9-20-195-66:sample_node_app chrissharp$
dhcp-9-20-195-66:sample_node_app chrissharp$ docker push localhost:5000/node_sample:local
The push refers to a repository [localhost:5000/node_sample]
Get http://localhost:5000/v2/: dial tcp 127.0.0.1:5000: getsockopt: connection refused
chrisesharp commented 6 years ago

OK..I've traced the problem...it's to do with docker daemon running in a VM on Mac and so localhost is not my shell's localhost :-(

Followed other instructions and got help from the Registry guys, to expose kube-registry as a NodePort in minikube instead. Now I can docker push the image into minikube registry, but the sample_node_app is failing to pull it from within minikube...

  Normal   Pulling                9m (x2 over 9m)  kubelet, minikube  pulling image "192.168.99.100:32767/node_sample:local"
  Warning  Failed                 9m (x2 over 9m)  kubelet, minikube  Failed to pull image "192.168.99.100:32767/node_sample:local": rpc error: code = 2 desc = Error response from daemon: {"message":"Get https://192.168.99.100:32767/v1/_ping: http: server gave HTTP response to HTTPS client"}
  Warning  FailedSync             9m (x3 over 9m)  kubelet, minikube  Error syncing pod
chrisesharp commented 6 years ago

OK fixed this - now need to start minikube like this:- minikube start --insecure-registry 192.168.99.100:32767 This then enables the pods to pull from the kube-registry service we're running in there.