1

I'm trying to access a locally hosted service from within a Minikube cluster running on Hyper-V. In this question the user made use of the VirtualBox-provided IP (10.0.2.2) to loop back to the host IP.

Is there an equivalent IP for Hyper-V?

I'm running Hyper-V on Windows 10 Pro with Minikube v0.28.2.

vandiedakaf
  • 514
  • 1
  • 6
  • 18
  • Maybe it's more related to the communication topic between host and Hyper-V guest VM, look at this [link](https://superuser.com/questions/1185502/hyper-v-access-host-in-offline-mode). – Nick_Kh Sep 20 '18 at 11:47
  • How did you configure Hyper-V switch for `Minikube`? What OS do you use for Hyper-V? – Nick_Kh Sep 20 '18 at 11:53
  • @mk_sta I've updated the question. As for the switch I created an external network as per the instructions on https://medium.com/@JockDaRock/minikube-on-windows-10-with-hyper-v-6ef0f4dc158c. – vandiedakaf Sep 20 '18 at 13:02

1 Answers1

2

You can use the IP of Hyper-V External switch created for minikube connection rendering.

  1. Open your Hyper-V manager and check the name of External virtual switch. In this guide it's called "Primary Virtual Switch".
  2. Check the IP address for this Hyper-V network interface on your Windows 10 machine.
  3. Try to use this IP address in your minikube project for communication purposes with a service residing on the local machine.

I've used busybox Pod and tested it on my machine:

apiVersion: v1
kind: Pod
metadata:
  name: busybox
  namespace: default
spec:
  containers:
  - image: busybox
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
    name: busybox
  restartPolicy: Always

I was able to ping target local machine from the Pod's container:

kubectl exec -ti busybox -- ping XXX.XX.XX.XX
Nick_Kh
  • 5,089
  • 2
  • 10
  • 16