<p>I'm new to Kubernetes and I'm learning. I have my Windows 8 machine where I installed Vagrant. Using vagrant I'm running ubuntu VM and inside that VM I'm running 3 docker containers.</p>

<p>Vagrant file:</p>

<pre><code>Vagrant.configure(2) do |config|
  config.vm.box = "test"
  config.vm.network "public_network"
  config.vm.network "forwarded_port", guest: 8080, host: 8080
  config.vm.network "forwarded_port", guest: 50000, host: 50000
  config.vm.network "forwarded_port", guest: 8081, host: 8089
  config.vm.network "forwarded_port", guest: 9000, host: 9000
  config.vm.network "forwarded_port", guest: 3306, host: 3306
    config.vm.provider "virtualbox" do |v|
        v.memory = 2048
        v.cpus = 2
    end
    config.vm.provider "virtualbox" do |v|
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
end
</code></pre>

<p>Container in Ubuntu VM :</p>

<pre><code>root@vagrant-ubuntu-trusty:~/docker-containers# docker images
REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
dockercontainers_jenkins                               latest              bb1142706601        4 days ago          1.03GB
dockercontainers_sonar                                 latest              3f021a73750c        4 days ago          1.61GB
dockercontainers_nexus                                 latest              ddc31d7ad052        4 days ago          1.06GB
jenkins/jenkins                                        lts                 279f21046a63        4 days ago          813MB
openjdk                                                8                   7c57090325cc        5 weeks ago         737MB
</code></pre>

<p>In same VM now I installed minikube and kubectl as mentioned in this <a href="https://github.com/kubernetes/minikube" rel="noreferrer">link</a></p>

<p>minikube version:</p>

<pre><code>minikube version: v0.24.1
</code></pre>

<p>kubectl version:</p>

<pre><code>Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.1", GitCommit:"3a1c9449a956b6026f075fa3134ff92f7d55f812", GitTreeState:"clean", BuildDate:"2018-01-04T11:52:23Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>Minikube successfully started in my ubuntu VM. I have created <code>pod.yml</code> file.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: testsonaralm
  labels:
    app: sonar_alm
spec:
  containers:
  - name: alm-sonar
    image: dockercontainers_sonar:latest
    imagePullPolicy: IfNotPresent
    ports:
    - containerPort: 9000
</code></pre>

<p>Using this yml file, I created a pod in minikube</p>

<pre><code>root@vagrant-ubuntu-trusty:~/docker-containers# kubectl create -f test_pod.yml
pod "testsonaralm" created
</code></pre>

<p>Now I created a service using <code>kubectl</code> command.</p>

<pre><code>root@vagrant-ubuntu-trusty:~/docker-containers# kubectl expose pod testsonaralm --port=9000 --target-port=9000 --name almsonar
service "almsonar" exposed

root@vagrant-ubuntu-trusty:~/docker-containers# kubectl get service
NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
almsonar     ClusterIP   10.102.86.193   &lt;none&gt;        9000/TCP   10s
kubernetes   ClusterIP   10.96.0.1       &lt;none&gt;        443/TCP    3d
</code></pre>

<p>When I tried to access the URL from my Host machine, I'm getting "Network Error".</p>

<pre><code>root@vagrant-ubuntu-trusty:~/docker-containers# kubectl describe svc almsonar
Name:              almsonar
Namespace:         default
Labels:            app=sonar_alm
Annotations:       &lt;none&gt;
Selector:          app=sonar_alm
Type:              ClusterIP
IP:                10.101.237.223
Port:              &lt;unset&gt;  9000/TCP
TargetPort:        9000/TCP
Endpoints:         172.17.0.1:9000
Session Affinity:  None
Events:            &lt;none&gt;
root@vagrant-ubuntu-trusty:~/docker-containers# minikube ip
127.0.0.1
</code></pre>

<p>When I execute the <code>minikube service almsonar --url</code> command, I get an Empty response. So I deleted the service and created a new service with modified command.</p>

<pre><code>root@vagrant-ubuntu-trusty:~/docker-containers# kubectl expose pod testsonaralm --type=NodePort --name almsonar
service "almsonar" exposed
</code></pre>

<p>Now when I run <code>minikube service almsonar --url</code> command,I got an URL as </p>

<pre><code>root@vagrant-ubuntu-trusty:~/docker-containers# minikube service almsonar --url
http://127.0.0.1:31209

root@vagrant-ubuntu-trusty:~/docker-containers# kubectl describe svc almsonar
Name:                     almsonar
Namespace:                default
Labels:                   app=sonar_alm
Annotations:              &lt;none&gt;
Selector:                 app=sonar_alm
Type:                     NodePort
IP:                       10.101.192.1
Port:                     &lt;unset&gt;  9000/TCP
TargetPort:               9000/TCP
NodePort:                 &lt;unset&gt;  30600/TCP
Endpoints:                172.17.0.1:9000
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
root@vagrant-ubuntu-trusty:~/docker-containers# minikube ip
127.0.0.1
</code></pre>

<p>I'm unable to access this URL in my Ubuntu VM, </p>

<pre><code>root@vagrant-ubuntu-trusty:~/docker-containers# curl http://127.0.0.1:31209
&lt;HTML&gt;
&lt;HEAD&gt;&lt;TITLE&gt;Redirection&lt;/TITLE&gt;&lt;/HEAD&gt;
&lt;BODY&gt;&lt;H1&gt;Redirect&lt;/H1&gt;&lt;/BODY&gt;
</code></pre>

<p>When I read the Kubernetes document, the minikube service URL will have a vaild IP. But in my case URL contains localhost IP address.</p>

<p>From what I see, you executed <code>minikube start</code> inside the Ubuntu VM. By default, this would try to download the minikube ISO and launch another VM (VM inside a VM) where minikube would be running. </p>

<p>I think that this nested virtualization is causing issues with your installation. If, for some reason, minikube started with <code>--vm-driver=none</code> to avoid the VM inside the VM (I think this is the case, looking at the 127.0.0.1 UP), there are some features that are in beta (by the time this answer was written), which could explain the weird behaviour. Because of this, my first advice would be to execute minikube inside the Windows host so it spins up a VM inside virtualbox. Inside you could reproduce the container environment you previously had, and execute the kubectl commands from the Windows host. Most of the documentation assume this setup, so you would not see differences like 127.0.0.1 in localhost.</p>

<p>In any case, in order to have full redirection and check if the service is running, try executing the curl command like this:</p>

<pre><code>    curl -L http://127.0.0.1:31209
</code></pre>
