On a Mac, what IP will represent my laptop from within a minikube cluster? On a Mac, what IP will represent my laptop from within a minikube cluster? kubernetes kubernetes

On a Mac, what IP will represent my laptop from within a minikube cluster?


You should be able to use the ipv4 address listed under vboxnet0. Look for the vboxnet0 interface in the list of outputs for ifconfig. Alternatively the address 10.0.2.2 will also map back to the host from the guest.

This IP address will be accessible from within the guest but not directly from within a pod. To make it accessible from within a pod you will need to create a headless service that exposes this IP address.
See this answer for how to create a headless service:Minikube expose MySQL running on localhost as service

So for example I ran a server at port :8000 on my host and did the following to access it in a pod:

$ kubectl create -f service.yaml----service.yaml----apiVersion: v1 kind: Service metadata:    name: my-service spec:    ports:        - protocol: TCP          port: 1443          targetPort: 8000$ kubectl create -f endpoint.yaml----endpoint.yaml----apiVersion: v1kind: Endpointsmetadata:    name: my-servicesubsets:    - addresses:        - ip: 192.168.99.1 #ipv4 address from vboxnet0      ports:        - port: 8000$ kubectl get svcNAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGEkubernetes   10.0.0.1     <none>        443/TCP    2hmy-service   10.0.0.83    <none>        1443/TCP   17m

Then you can access the host service by using 10.0.0.83:1443 within a pod.