<p>I want to integrate my vuejs app into a minikube cluster.</p>
<p>I used the Dockerfile from the VueJs tutorial for the production with the Nginx webserver  and with the first option <code>localhost:8080</code>  <a href="https://v2.vuejs.org/v2/cookbook/dockerize-vuejs-app.html" rel="nofollow noreferrer">here</a>. I changed the ports in the yml files accordingly meaning for the localhost to 8080 and for the nginx version as seen below to 80</p>
<p>Then in my <code>config/index.js</code></p>
<pre><code>  dev: {

 [...]
    host: 'localhost', // can be overwritten by process.env.HOST
    port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: false,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
[...]
}, 
</code></pre>
<p>I have set the default 8080 port. For my minikube deployment and service I added</p>
<pre><code>apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: vuejs
spec:
  selector:
    matchLabels:
      app: vuejs
      tier: frontend
  replicas: 1
  template:
    metadata:
      labels:
        app: vuejs
        tier: frontend
    spec:
      imagePullSecrets:
      - name: regcred
      containers:
        - name: vuejs
          image: &lt;secret registry&gt; 
          ports:
            - containerPort: 80
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
---
apiVersion: v1
kind: Service
metadata:
  name: vuejs
  labels:
    app: vuejs
    tier: frontend
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 80
  # Replace with the IP of your minikube java / master java
  # externalIPs:
  #  - 192.168.99.105 
  selector:
    app: vuejs
    tier: frontend
</code></pre>
<p>How do I connect to the vuejs/nginx webserver. Moreover since I set the DNS name of the backend to <code>java</code> how do I set the java REST API address in vuejs?
I set the address to <code>'http://java:8080/'</code> without any response. The Java REST backend is integrated into minikube with <a href="https://ptpb.pw/3TxD" rel="nofollow noreferrer">this</a> yml.</p>
<p>The curios issue is that after starting the vuejs deployment I can access the vuejs app at <code>127.0.0.1:8080</code>. When I understood correctly I thought that the kubernetes cluster opens up its own network and is only accessible via external IP</p>
<p>Looking at my <code>kubectl get all</code> I would say that vuejs should be reachable <code>192.168.99.105:8080</code> - when using the dockerimage without the nginx.</p>
<pre><code>NAME                         READY   STATUS    RESTARTS   AGE
pod/java-fbf949cbc-rqstq     0/1     Error     4          2d
pod/maria-7b67c8ddf-xp8xx    1/1     Running   2          2d
pod/private-reg              1/1     Running   5          5d
pod/vuejs-5f4c657d74-885j9   1/1     Running   1          18h
NAME                 TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)          AGE
service/java         LoadBalancer   10.101.207.98   192.168.99.100   8080:31011/TCP   2d
service/kubernetes   ClusterIP      10.96.0.1       &lt;none&gt;           443/TCP          5d
service/maria        ClusterIP      10.99.177.228   &lt;none&gt;           3306/TCP         2d
service/vuejs        NodePort       10.104.108.44   192.168.99.105   8080:30001/TCP   17h
NAME                    DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/java    1         1         1            0           2d
deployment.apps/maria   1         1         1            1           2d
deployment.apps/vuejs   1         1         1            1           18h
NAME                               DESIRED   CURRENT   READY   AGE
replicaset.apps/java-fbf949cbc     1         1         0       2d
replicaset.apps/maria-7b67c8ddf    1         1         1       2d
replicaset.apps/vuejs-5f4c657d74   1         1         1       18h
</code></pre>

A.Dumas
<p>You can use <code>minikube service</code> command to get the url exposed to your own host. For your deployment, try:</p>

<pre><code>minikube service vuejs --url
</code></pre>

<p>It would show an IP with the NodePort added to it. Copy and paste the result of that command to your browser.</p>

<h1>Update: How it works</h1>

<p>Minikube starts a virtual machine inside your host (your laptop) with a single-node Kubernetes cluster, assigning a local IP that you can get with <code>minikube ip</code> command. That’s the IP of the Kubernetes node.</p>

<p>When you expose a "NodePort" service inside Kubernetes, it allocates a static port from range 30000-32767 (default) so you can access that service with <code>&lt;NodeIP&gt;:&lt;NodePort&gt;</code></p>
