map local ip to external/host IP... IP forwarding?

2/11/2018

I am running solr inside minikube for a POC. I am trying to figure out how to access the solr inside the minikube. As per my knowledge I cant access solr using my host IP, it is only accessible using the minikube IP - 192.168.99.100:8983/solr. My objective is to hit the solr server when accessing it from a remote box.

One of my team mates suggested that I can maybe use something that will forward incoming request to a local IP.

Any suggestions??

Thanks

-- jsp
kubernetes
macos
minikube
portforwarding
solr

2 Answers

2/11/2018

You would need to expose the solr service using the kubectl expose command for external access.

There are four ways to expose a service for external access in k8s:

  1. LoadBalancer service type which sets the ExternalIP automatically. This is used when there is an external non-k8s, cloud-provider's load-balancer like CGE, AWS or Azure, and this external load-balancer would provide the ExternalIP for the nginx ingress service per https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types.
  2. ExternalIPs per https://kubernetes.io/docs/concepts/services-networking/service/#external-ips.
  3. NodePort: In this approach, the service can be hit from outside the cluster using NodeIP:NodePort/url/of/the/service.
  4. Ingress: https://kubernetes.io/docs/concepts/services-networking/ingress/
-- Vikram Hosakote
Source: StackOverflow

2/11/2018

First you need to get URL of your Service for solr.

$ minikube service <service-name> --url
http://192.168.99.100:30000

Here, 30000 is your solr Service NodePort.

Now you need to create SSH tunnel.

For that try this

$ ssh -i ~/.minikube/machines/minikube/id_rsa docker@$(minikube ip) -L \*:30000:0.0.0.0:30000

Note: To keep SSH tunneling in Background, add & at the end of (ssh -i .....) &

Now you can access this solr Service using your Host IP address

-- Mir Shahriar Sabuj
Source: StackOverflow