How to map 'localhost' to minikube with Ingress

12/3/2019

I'm using minikube version 1.4.0 and Kubernetes version 1.16.0 on MacOS 10.15.

I'm developing some authorization/authentication code that relies on an external service. In the API calls to the service, I'm required to provide a redirect URL. The URL has to be either 1) a legit FQDN from an external service (when I go to production) or 2) localhost/<whatever>. My code, however, does not use localhost - it uses a custom minikube.local which maps to Minikube's IP (as opposed to 127.0.0.1).

Note - I could use NodePort type Kubernetes services and port-forward them which would, for example, allow me to hit my Django server at localhost:8000. However, I am choosing to use Ingress (so my Minikube environment most closely resembles my production environment) which takes away this ability.

Is there a way to use localhost instead of my Minikube's IP and its associated DNS name?

-- s g
kubernetes-ingress
localhost
minikube

0 Answers