I am using a VPN connection to access corporate resources from my Laptop. However, I am unable to access these resources from the VM created by Minikube.
I want to be able to do exactly this but the address of the external resource is unreachable from the cluster.
Any ideas how I can do this with Minikube?
I was actually able to access the corporate network from the VM by downloading the latest version of virtualbox and using that as the --vm-driver
for minikube while connected to the VPN on my laptop. (Was using hyperkit before)
minikube start --vm-driver=virtualbox
You need to make sure you have correctly defined endpoints
and services
. That way Kubernetes will redirect requests from inside the pod to the desired outside IP. It is well described in this answer which I am posting as a community wiki here:
Create
Endpoints
that will forward traffic to your desire external IP address (your local machine). You can directly connect usingEndpoints
but according toGoogle Cloud best practice
(doc) is to access it through aService
Create your
Endpoints
kind: Endpoints apiVersion: v1 metadata: name: local-ip subsets: - addresses: - ip: 10.240.0.4 # IP of your desire end point ports: - port: 27017 # Port that you want to access Then create you `Service` kind: Service apiVersion: v1 metadata: name: local-ip Spec: type: ClusterIP ports: - port: 27017 targetPort: 27017
Now you can call external http service using the
Service
name. In this caseloal-ip
like any other internal service ofminikube
.
Please let me know if that helped.