<p>I'm new to kubernetes and I'm trying to deploy a MEAN stack app with Gitlab pipelines to Kubernetes Engine in Google Cloud. However I just can't get it to let me connect to a pod running my code on an open port (4200). You can find my YAML configs below.
<strong>Dockerfile</strong></p>

<pre><code>FROM node:13.13-alpine
RUN mkdir -p /usr/src/app
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN cd /usr/src/app &amp;&amp; npm install @angular/core@9.1.4 @angular/animations@9.1.4 @angular/common@9.1.4 @angular/forms@9.1.4 @angular/platform-browser@9.1.4 @angular/router@9.1.4 @angular/platform-browser-dynamic@9.1.4 @angular/compiler@9.1.4 @angular/compiler-cli@9.1.4 @angular/language-service@9.1.4 &amp;&amp; npm install &amp;&amp; npm run-script build
EXPOSE 3000 4200
CMD ["npm","run-script","start"]
</code></pre>

<p><strong>Gitlab-ci.yml</strong></p>

<pre><code>deploy service:
    stage: deploy_kubernetes
    image: google/cloud-sdk:latest
    script:
        # Auth and GC Cluster configs
        - echo $GKE_SERVICE_KEY | base64 -d &gt; service-account.json
        - gcloud auth activate-service-account --key-file service-account.json
        - gcloud container clusters get-credentials $GKE_cluster_name --zone $GKE_zone --project $GKE_project_id
        # Kompose to build deployment files
        - curl -L https://github.com/kubernetes/kompose/releases/download/v1.19.0/kompose-linux-amd64 -o kompose
        - chmod +x kompose
        - mv ./kompose /usr/local/bin/kompose
        - kompose convert -f deploy/docker-compose-stack.yml
        # Kompose patches and service creating in Kubernetes
        - kubectl apply -f mean-deployment.yaml,mean-service.yaml
        - echo $PATCH_LOAD_BALANCER | base64 -d &gt; patch_load_balancer.json
        - kubectl patch svc mean --patch "$(cat patch_load_balancer.json)"
</code></pre>

<p><strong>docker-compose-stack.yml</strong></p>

<pre><code>version: "3.7"
services: 
    mean: 
        image: theycallmefox/gp_ips:latest
        ports: 
            - 3000:3000
            - 4200:4200
</code></pre>

<p>Running <strong>kubectl get svc --all-namespaces</strong> gets me the following output:</p>

<pre><code>NAMESPACE     NAME                   TYPE           CLUSTER-IP    EXTERNAL-IP    PORT(S)                                                    AGE
default       kubernetes             ClusterIP      10.0.0.1      &lt;none&gt;         443/TCP                                                    3d
default       mean                   LoadBalancer   10.0.12.199   34.91.94.183   443:31324/TCP,80:32732/TCP,3000:32577/TCP,4200:32512/TCP   2d2h
kube-system   default-http-backend   NodePort       10.0.4.122    &lt;none&gt;         80:32038/TCP                                               2d23h
kube-system   kube-dns               ClusterIP      10.0.0.10     &lt;none&gt;         53/UDP,53/TCP                                              2d23h
kube-system   metrics-server         ClusterIP      10.0.1.220    &lt;none&gt;         443/TCP                                                    2d23h
</code></pre>

<p>Finally, running <strong>kubectl logs -f mean-6cb9949f77-kbz95</strong></p>

<pre><code>&gt; portal-ips@0.0.0 start /usr/src/app
&gt; ng serve &amp;&amp; cd ../backend &amp;&amp; node app.js
chunk {main} main.js, main.js.map (main) 412 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 141 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 219 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.12 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 5.6 MB [initial] [rendered]
Date: 2020-05-24T17:50:28.305Z - Hash: a02a05a0d81f690bca61 - Time: 35281ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.
</code></pre>

<p>Any ideas? Thanks.</p>

Andrew Fox
<p>You application is listening on localhost, while your load balancer forwards the traffic to the ethernet network interface.</p>

<p>You will need to change your app and make it serve on <code>0.0.0.0</code>.</p>
