<p>I have created Docker images and deployed in k8s cluster with a minimum number of machines, setup one master and worker and both machines are up and running and talking to each other with the same VLAN network.</p>

<p>Please find the below pod and deployment services with described status</p>

<pre><code>root@jenkins-linux-vm:/home/admin# kubectl describe services angular-service
Name:                     angular-service
Namespace:                pre-release
Labels:                   &lt;none&gt;
Annotations:              kubectl.kubernetes.io/last-applied-configuration:
                            {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"angular-service","namespace":"pre-release"},"spec":{"ports":[{"no...
Selector:                 app=frontend-app
Type:                     NodePort
IP:                       10.96.151.155
Port:                     &lt;unset&gt;  80/TCP
TargetPort:               80/TCP
NodePort:                 &lt;unset&gt;  31000/TCP
Endpoints:                10.32.0.6:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;

root@jenkins-linux-vm:/home/admin# kubectl get pods
NAME                                  READY   STATUS    RESTARTS   AGE
angular-deployment-7b8d45f48d-b59pv   1/1     Running   0          51m

root@jenkins-linux-vm:/home/admin# kubectl get svc
NAME              TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
angular-service   NodePort   10.96.151.155   &lt;none&gt;        80:31000/TCP   64m


root@jenkins-linux-vm:/home/admin# kubectl get pods --selector="app=frontend-app" --output=wide
NAME                                  READY   STATUS    RESTARTS   AGE   IP          NODE               NOMINATED NODE   READINESS GATES
angular-deployment-7b8d45f48d-b59pv   1/1     Running   0          52m   10.32.0.6   poc-worker2   &lt;none&gt;           &lt;none&gt;

root@jenkins-linux-vm:/home/admin# kubectl describe pods angular-deployment-7b8d45f48d-b59pv
Name:         angular-deployment-7b8d45f48d-b59pv
Namespace:    pre-release
Priority:     0
Node:         poc-worker2/10.0.0.6
Start Time:   Tue, 21 Jan 2020 05:15:49 +0000
Labels:       app=frontend-app
              pod-template-hash=7b8d45f48d
Annotations:  &lt;none&gt;
Status:       Running
IP:           10.32.0.6
IPs:
  IP:           10.32.0.6
Controlled By:  ReplicaSet/angular-deployment-7b8d45f48d
Containers:
  frontend-app:
    Container ID:   docker://751a9fb4a5e908fa1a02eb0460ab1659904362a727a028fdf72489df663a4f69
    Image:          frontend-app:future-master-fix-d1afa608
    Image ID:       docker://sha256:0099587db89de9ef999a7d1f087d4781e73c491b17e89392e92b08d2f935ad27
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Tue, 21 Jan 2020 05:15:54 +0000
    Ready:          True
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-r67p7 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  default-token-r67p7:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-r67p7
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          &lt;none&gt;

</code></pre>

<p>Now the problem is I'm not able to access my application using a port, even though its not working in a web browser as well.</p>

<pre><code>curl http://&lt;public-node-ip&gt;:&lt;node-port&gt;

curl http://10.0.0.6:31000

</code></pre>

<p>Dockr file</p>

<pre><code>FROM node:latest as node
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build --prod

# stage 2
FROM nginx:alpine
COPY --from=node /app/dist/hello-angular /usr/share/nginx/html
</code></pre>

<pre><code>root@jenkins-linux-vm:/home/admin# kubectl exec -it angular-deployment-7b8d45f48d-b59pv curl 10.96.151.155:80
curl: (7) Failed to connect to 10.96.151.155 port 80: Connection refused
command terminated with exit code 7
</code></pre>

<pre><code>root@jenkins-linux-vm:/home/admin/kubernetes# kubectl run busybox --image=busybox --restart=Never -it --rm --command -- /bin/sh -c "wget 10.96.208.252:80;cat index.html"
Connecting to 10.96.208.252:80 (10.96.208.252:80)
saving to 'index.html'
index.html           100% |********************************|   593  0:00:00 ETA
'index.html' saved
&lt;!doctype html&gt;&lt;html lang="en"&gt;&lt;head&gt;&lt;meta charset="utf-8"&gt;&lt;title&gt;AngularApp&lt;/title&gt;&lt;base href="/"&gt;&lt;meta name="viewport" content="width=device-width,initial-scale=1"&gt;&lt;link rel="icon" type="image/x-icon" href="favicon.ico"&gt;&lt;link href="styles.9c0ad738f18adc3d19ed.bundle.css" rel="stylesheet"/&gt;&lt;/head&gt;&lt;body&gt;&lt;app-root&gt;&lt;/app-root&gt;&lt;script type="text/javascript" src="inline.720eace06148cc3e71aa.bundle.js"&gt;&lt;/script&gt;&lt;script type="text/javascript" src="polyfills.f20484b2fa4642e0dca8.bundle.js"&gt;&lt;/script&gt;&lt;script type="text/javascript" src="main.11bc84b3b98cd0d00106.bundle.js"&gt;&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;pod "busybox" deleted
</code></pre>

<pre><code>root@jenkins-linux-vm:/home/admin/kubernetes# kubectl run busybox --image=busybox --restart=Never -it --rm --command -- /bin/sh -c "wget 10.0.0.6:32331;cat index.html"
Connecting to 10.0.0.6:32331 (10.0.0.6:32331)
wget: can't connect to remote host (10.0.0.6): Connection refused
cat: can't open 'index.html': No such file or directory
pod "busybox" deleted
pod pre-release/busybox terminated (Error)

</code></pre>

<p>I am taking a pre-built angular image from docker hub with thanks to <code>https://github.com/nheidloff/web-apps-kubernetes/tree/master/angular-app</code> we will use this image as baseline below.</p>

<p><strong>Create and deployment and service using below yamls</strong> </p>

<p><strong>Deployment.yaml</strong> </p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: angular-app
spec:
  replicas: 1
  selector:
    matchLabels:
      run: angular-app
  template:
    metadata:
      labels:
        run: angular-app
    spec:
      containers:
      - name: angular-app
        image: nheidloff/angular-app
        ports:
        - containerPort: 80
        - containerPort: 443
</code></pre>

<p><strong>Service.yaml</strong> </p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: angular-app
  labels:
    run: angular-app
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP
    name: http
  - port: 443
    protocol: TCP
    name: https
  selector:
    run: angular-app
</code></pre>

<p><strong>Run as below on your cluster to create the resources</strong> </p>

<pre><code>$ kubectl create -f Deployment.yaml
$ kubectl create -f Service.yaml
</code></pre>

<p><strong>Should result in below deployment and service configuration</strong> </p>

<pre><code>    $ kubectl get all -o wide
NAME                               READY   STATUS    RESTARTS   AGE     IP            NODE         NOMINATED NODE   READINESS GATES

pod/angular-app-694d97d56c-7m4x4   1/1     Running   0          8m23s   10.244.3.10   k8s-node-3   &lt;none&gt;           &lt;none&gt;

NAME                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE     SELECTOR
service/angular-app   NodePort    10.96.150.136   &lt;none&gt;        80:32218/TCP,443:30740/TCP   8m23s   run=angular-app
service/kubernetes    ClusterIP   10.96.0.1       &lt;none&gt;        443/TCP                      8d      &lt;none&gt;

NAME                          READY   UP-TO-DATE   AVAILABLE   AGE     CONTAINERS    IMAGES                  SELECTOR
deployment.apps/angular-app   1/1     1            1           8m23s   angular-app   nheidloff/angular-app   run=angular-app

NAME                                     DESIRED   CURRENT   READY   AGE     CONTAINERS    IMAGES                  SELECTOR
replicaset.apps/angular-app-694d97d56c   1         1         1       8m23s   angular-app   nheidloff/angular-app   pod-template-hash=694d97d56c,run=angular-app
</code></pre>

<blockquote>
  <p>From above we can see the pod is running node-3 , so identify the ip of node 3 
  and we see that service has exposed below ports 32218/TCP and 30740/TCP</p>
</blockquote>

<pre><code>$ kubectl get nodes -o wide
NAME           STATUS   ROLES    AGE   VERSION   INTERNAL-IP       EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
master-1   Ready    master   8d    v1.17.0   111.112.113.107   &lt;none&gt;        Ubuntu 16.04.6 LTS   4.4.0-169-generic   docker://18.6.2
node-1     Ready    &lt;none&gt;   8d    v1.17.0   111.112.113.108   &lt;none&gt;        Ubuntu 16.04.6 LTS   4.4.0-169-generic   docker://18.6.2
node-2     Ready    &lt;none&gt;   8d    v1.17.0   111.112.113.109   &lt;none&gt;        Ubuntu 16.04.6 LTS   4.4.0-169-generic   docker://18.6.2
node-3     Ready    &lt;none&gt;   8d    v1.17.0   111.112.113.110   &lt;none&gt;        Ubuntu 16.04.6 LTS   4.4.0-169-generic   docker://18.6.2
</code></pre>

<blockquote>
  <p>So we need to access the app vi <code>node3:NodePort</code> i.e <code>111.112.113.110:32218</code> as url check below screen shot as well on how i access the app.</p>
</blockquote>

<p><a href="https://i.stack.imgur.com/Q0Thf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q0Thf.png" alt="enter image description here"></a></p>

<p><strong>I have below rules open on cluster level to allow browser access the apps on default NodePort range.</strong></p>

<blockquote>
  <p>NOTE : Ingress    IPv4    TCP 30000 - 32767   0.0.0.0/0</p>
</blockquote>
