change upper case & add new step

pull/7603/head
Alonyb 2020-04-17 14:02:52 -05:00
parent 40e87af21d
commit 6bde0e0f5d
1 changed files with 30 additions and 4 deletions

View File

@ -20,9 +20,9 @@ Here is a table to help you with registry addon:
## Requirements
* Registry addon enabled
* Run Minikube on KIC driver (see table).
* Run minikube on KIC driver (see table).
## Start Minikube enabling registry addon
## Start minikube enabling registry addon
Open a shell console, and run the following command:
@ -30,6 +30,7 @@ Open a shell console, and run the following command:
minikube start --addons=registry --vm-driver={{docker | podman}}
```
---
## 1. Usage Registry for drivers that dont need port forward
Build docker image and tag it appropriately:
@ -43,14 +44,39 @@ Push docker image to minikube registry:
docker push $(minikube ip):5000/test-img
```
---
## 2. Use Registry for docker on mac and windows
Build docker image and tag it appropriately:
#### Accept pushed images on Mac
In order to make docker accept pushing images to this registry, we have to redirect port 5000 on the docker virtual machine over to port 5000 on the minikube machine. We can (ab)use dockers network configuration to instantiate a container on the dockers host, and run socat there:
```shell
docker build --tag $(minikube ip):$(docker inspect --format '{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}' <container_id>)/test-img .
docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000"
```
Push docker image to minikube registry:
#### Accept pushing images on Windows
In order to make docker accept pushing images to this registry, we have to redirect port 5000 on the docker virtual machine over to port 5000 on the minikube machine. Unfortunately, the docker vm cannot directly see the IP address of the minikube vm. To fix this, you will have to add one more level of redirection.
Use kubectl port-forward to map your local workstation to the minikube vm
```shell
kubectl port-forward --namespace kube-system <name of the registry vm> 5000:5000
```
On your local machine you should now be able to reach the minikube registry by using curl `http://localhost:5000/v2/_catalog`
From this point we can (ab)use dockers network configuration to instantiate a container on the dockers host, and run socat there to redirect traffic going to the docker vms port 5000 to port 5000 on your host workstation.
```shell
docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:host.docker.internal:5000"
```
#### Push docker image to minikube registry:
```shell
docker push $(minikube ip):$(docker inspect --format '{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}' <container_id>/test-img