How to get the minikube ip virtual machine address within a container running inside minikube

6/29/2019

I need to get the minikube ip address from inside a container running inside the minikube cluster. Currently I am using an environment variable which is set before the pod is launched. I DO NOT want to use this because the ip address can change. I need someway of dynamically obtaining the ip address of the virtual machine that the minikube virtual machine is running on.

Thanks

-- Josh Woodcock
kubernetes
minikube

1 Answer

8/16/2019

My current solution / workaround is to use a helm chart for the service I want to provide the ip to then when I install / update the chart I use --set minikubeIP=$(minikube ip) then that helm chart has a hard coded environment with the minikube ip for the the pod that needs the minikube ip. Not really ideal but it works.

-- Josh Woodcock
Source: StackOverflow