From c48b22bbd8d5ee936981063e929a025f15014772 Mon Sep 17 00:00:00 2001 From: Alonyb Date: Fri, 17 Apr 2020 20:38:58 -0500 Subject: [PATCH] change table of pushing doc --- site/content/en/docs/handbook/pushing.md | 12 ++--- site/content/en/docs/handbook/registry.md | 65 ++++++++++++++++++++++- 2 files changed, 70 insertions(+), 7 deletions(-) diff --git a/site/content/en/docs/handbook/pushing.md b/site/content/en/docs/handbook/pushing.md index 32c58edf2f..7a0646c7b0 100644 --- a/site/content/en/docs/handbook/pushing.md +++ b/site/content/en/docs/handbook/pushing.md @@ -15,13 +15,13 @@ The best method to push your image to minikube depends on the container-runtime Here is a comparison table to help you choose: -| Method | Supported Runtimes | Issues | Performance | +| Method | Supported Runtimes | | Performance | |--- |--- |--- |--- |--- | -| [docker-env command](/docs/handbook/pushing/#1pushing-directly-to-the-in-cluster-docker-daemon-docker-env) | only docker | | good | -| [podman-env command](/docs/handbook/pushing/#3-pushing-directly-to-in-cluster-crio-podman-env) | only cri-o | | good | -| [cache add command](/pushing/#2-push-images-using-cache-command) | all | | ok | -| [registry addon](/docs/handbook/pushing/#4-pushing-to-an-in-cluster-using-registry-addon) | all | work in progress for [docker on mac](https://github.com/kubernetes/minikube/issues/7535) | ok | -| [minikube ssh](/docs/handbook/pushing/#5-building-images-inside-of-minikube-using-ssh) | all | | best | +| [docker-env command](/docs/handbook/pushing/#1pushing-directly-to-the-in-cluster-docker-daemon-docker-env) | only docker | good | +| [podman-env command](/docs/handbook/pushing/#3-pushing-directly-to-in-cluster-crio-podman-env) | only cri-o | good | +| [cache add command](/pushing/#2-push-images-using-cache-command) | all | ok | +| [registry addon](/docs/handbook/pushing/#4-pushing-to-an-in-cluster-using-registry-addon) | all | ok | +| [minikube ssh](/docs/handbook/pushing/#5-building-images-inside-of-minikube-using-ssh) | all | best | * note1 : the default container-runtime on minikube is 'docker'. diff --git a/site/content/en/docs/handbook/registry.md b/site/content/en/docs/handbook/registry.md index 41f90d1593..5d6d8d8385 100644 --- a/site/content/en/docs/handbook/registry.md +++ b/site/content/en/docs/handbook/registry.md @@ -44,4 +44,67 @@ One nifty hack is to allow the kubelet running in minikube to talk to registries with TLS certificates. Because the default service cluster IP is known to be available at 10.0.0.1, users can pull images from registries deployed inside the cluster by creating the cluster with `minikube start --insecure-registry "10.0.0.0/24"`. -{{% readfile file="/docs/drivers/includes/registry_addon_mac_windows.inc" %}} +### docker on macOS + +Quick guide for configuring minikube and docker on macOS, enabling docker to push images to minikube's registry. + +The first step is to enable the registry addon: + +``` +minikube addons enable registry +``` + +When enabled, the registry addon exposes its port 5000 on the minikube's virtual machine. + +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: + +``` +docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000" +``` + +Once socat is running it's possible to push images to the minikube registry: + +``` +docker tag my/image localhost:5000/myimage +docker push localhost:5000/myimage +``` + +After the image is pushed, refer to it by `localhost:5000/{name}` in kubectl specs. + +### Docker on Windows + +Quick guide for configuring minikube and docker on Windows, enabling docker to push images to minikube's registry. + +The first step is to enable the registry addon: + +``` +minikube addons enable registry +``` + +When enabled, the registry addon exposes its port 5000 on the minikube's virtual machine. + +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 +``` +kubectl port-forward --namespace kube-system 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. + +``` +docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:host.docker.internal:5000" +``` + +Once socat is running it's possible to push images to the minikube registry from your local workstation: + +``` +docker tag my/image localhost:5000/myimage +docker push localhost:5000/myimage +``` + +After the image is pushed, refer to it by `localhost:5000/{name}` in kubectl specs. + +## \ No newline at end of file