title: How to access Kubernetes deployment
body: <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>