change upper case & add new step
parent
40e87af21d
commit
6bde0e0f5d
|
@ -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 docker’s network configuration to instantiate a container on the docker’s 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 docker’s network configuration to instantiate a container on the docker’s host, and run socat there to redirect traffic going to the docker vm’s 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
|
||||
|
|
Loading…
Reference in New Issue