Is it possible to have my development machine to be part of Minikube's network?
Ideally, it should work both ways:
- While developing an application in my IDE, I can access k8s resources inside Minikube using the same addressing that pods would use.
- Pods running in Minikube can access my application running in the IDE, for example via HTTP requests.
This sounds like the first part is feasible on GCE using network routes, so I wonder if it's doable locally using Minikube.
There is an issue open upstream (kubernetes/minikube#38) in order to discuss that particular use case.
kube-proxy
already adds the IPtables rules needed for IP forwarding inside theminikube
VM (this is not specific to minikube), so all you have to do is add a static route to the container network via the IP of minikube's eth1 interface on your local machine:Where
10.0.0.0/24
is the container network CIDR and192.168.42.58
is the IP of your minikube VM (obtained with theminikube ip
command).You can then reach Kubernetes services from your local environment using their cluster IP. Example:
This also allows you to resolve names in the
cluster.local
domain via the cluster DNS (kube-dns
addon):If you also happen to have a local
dnsmasq
running on you local machine you can easily take advantage of this and forward all DNS requests for thecluster.local
domain tokube-dns
: