<p>I am running Docker for Windows and Minikube (Kubernetes) to serve an Angular application. The angular application is served using <code>ng serve</code> and is working properly on windows. I created the below Dockerfile:</p>

<pre><code># Use an official Nodejs runtime as a parent image
FROM node:6.10.3

#Create an unprivileged user 'app'
#Install dependencies
RUN useradd --user-group --create-home --shell /bin/false app &amp;&amp;\
   npm install -g grunt-cli &amp;&amp;\
   npm install -g @angular/cli

# Define environment variable
ENV ENVIRONMENT="dev" HOME=/home/app

#Copy the code to the image
COPY . $HOME/frontend/

#Chmod the files to allow unprivileged user 'app' to read/write
RUN chown -R app:app $HOME/*

#Use unprivileged user 'app' to run the app inside the container
USER app

#Set Current Working Directory of the runtime 
WORKDIR $HOME/frontend

#Install NPM dependencies
RUN npm install

# Make port 8080 and 4200 available to the world outside this container
EXPOSE 4200

# Start the webpack server when the container launches
CMD ng serve
</code></pre>

<p>I have my environment variables set in windows for minikube along with my Docker variables (minikube docker-env) </p>

<pre><code>DOCKER_API_VERSION
DOCKER_CERT_PATH
DOCKER_HOST
DOCKER_MACHINE_NAME
DOCKER_TLS_VERIFY
</code></pre>

<p>I built the Docker image and tagged it as v1 :</p>

<pre><code>docker build -t frontend:v1 .
</code></pre>

<p>I deployed the POD from the image and exposed the deployment:</p>

<pre><code>kubectl run frontend --image=frontend:v1 --port=4200
kubectl expose deployment frontend --type=LoadBalancer
</code></pre>

<p>The <code>kubectl get pods</code> is showing my pod as running and <code>kubectl get deployments</code> is showing that my deployment is available</p>

<p>I executed a curl using <code>kubectl exec curl localhost:4200</code>, which executes on the container, and it is properly returning my page but when I try to run my service using <code>minikube service frontend</code> it opens the browser but can't reach my application.</p>

<p>It is worth noting that I did the same exact steps with a normal Nodejs application running using <code>node server.js</code> and it is served correctly using the same exact steps.</p>

<p>Any idea why my angular application is not served over Kubernetes when started using ng serve or how to go about figuring out what is the issue? I can see the mappings are correct from the Kubernetes Dashboard.</p>

<p>This is probably more related to <em>angular-cli</em>. <code>ng serve</code> only binds to <code>localhost</code> by default. Therefore your docker container is not listening on it's public IP address.</p>

<p>Try to use:</p>

<pre><code>ng serve --host 0.0.0.0
</code></pre>
