Skip to content

Instantly share code, notes, and snippets.

@loa
Last active January 9, 2018 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loa/a88803c5678381eb515ab7f1241199a3 to your computer and use it in GitHub Desktop.
Save loa/a88803c5678381eb515ab7f1241199a3 to your computer and use it in GitHub Desktop.
Minikube host networking integration

Minikube host networking integration

Make it possible for your host to do dns lookups and reach internal pods and svcs in Minikube directly.

Networking

MacOS:

$ sudo route -n add 10.96.0.0/12 $(minikube ip) # svc
$ sudo route -n add 172.17.0.0/16 $(minikube ip) # pods

Linux:

$ sudo ip route add 10.96.0.0/12 via $(minikube ip) # svc
$ sudo ip route add 172.17.0.0/16 via $(minikube ip) # pods

Fix issues with Minikube loosing connectivity

There seems to be an issue with virtio.

# needs to be redone when recreating minikube
$ minikube stop
$ sed -i 's/virtio/Am79C973/g' ~/.minikube/machines/minikube/config.json
$ minikube start

DNS

MacOS:

# Create /etc/resolver dir
$ sudo mkdir /etc/resolver

# Setup resolver to use Kubernetes dns server for all *.cluster.local lookups
$ echo "nameserver 10.96.0.10" | sudo tee /etc/resolver/cluster.local

# Restart MacOS resolver
$ sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache

Linux:

Todo

Troubleshooting

# List all resolvers
$ scutil --dns

# Try to reach internal kubernetes dns server
$ dig @10.96.0.10 kubernetes-dashboard.kube-system.svc.cluster.local

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment