Original: kubernetes/minikube#38 (comment)
This will make your minikube pod and service IPs routable from your host. If you only want service IPs, you can edit this accordingly.
OS: macOS ( should work for linux as well, but instead of sudo route -n
you would use sudo ip route in the script)
- Stop the minikube VM in case it's started
$ minikube stop
- Go to the virtualbox GUI (steps 2. and 3. are needed because of #1710)
- Right click on the minikube
VM -> Settings -> Network
forAdapter 1
andAdapter 2
select Advanced and change the adapter type to something other that Intel. For example,PCne-FAST III (Am79C973)
. - Open the minikube config file which should be here:
~/.minikube/machines/minikube/config.json
and change the value for the fields:NatNicType
andHostOnlyNicType
to match the ones that you set in virtualbox in the previous step. In this case, for example:Am79C973
.
-
Stop docker on your machine as the ip ranges that you're adding routes for might overlap with the docker ones.
-
Start minikube and wait for it to start
$ minikube start
- Make the script
setup_minikube_routing.sh
executable:
$ chmod +x ./scripts/setup_minikube_routing.sh
- Run the script to set up the routes
$ ./scripts/setup_minikube_routing.sh
- The IP ranges are hardcoded in the script. We should get those dinamically.
- Minikube needs to be running for the script to run successfully.
- Make sure that the routes you're adding don't overlap with some local routing that you have.
- If you have problems with a pod unable to reach itself through a service, you can run:
$ minikube ssh
$ sudo ip link set docker0 promisc on