title: AWS EKS Cluster , DockerHub and Traefik, not accessible from internet
body: <p><code>kubectl get nodes</code></p>
  <pre class="lang-sh prettyprint-override"><code>NAME                              STATUS   ROLES    AGE   VERSION
  ip-192-168-119-55.ec2.internal    Ready    &lt;none&gt;   29h   v1.16.12-eks-904af05
  ip-192-168-156-180.ec2.internal   Ready    &lt;none&gt;   29h   v1.16.12-eks-904af05
  ip-192-168-193-177.ec2.internal   Ready    &lt;none&gt;   29h   v1.16.12-eks-904af05
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>kubectl get svc
  
  NAME          TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE
  hostname-v2   ClusterIP   10.100.163.163   &lt;none&gt;        80/TCP    29h
  kubernetes    ClusterIP   10.100.0.1       &lt;none&gt;        443/TCP   36h
  my-app        ClusterIP   10.100.147.193   &lt;none&gt;        80/TCP    9m48s
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>kubectl get svc -n kube-system
  
  NAME                      TYPE           CLUSTER-IP       EXTERNAL-IP                                                              PORT(S)                       AGE
  kube-dns                  ClusterIP      10.100.0.10      &lt;none&gt;                                                                   53/UDP,53/TCP                 25h
  traefik-ingress-service   LoadBalancer   10.100.113.186   a262f21c7a0c740949c3321ab77a0259-639235071.us-east-1.elb.amazonaws.com   80:30015/TCP,8080:31515/TCP   88m
  </code></pre>
  <ul>
  <li><code>kubectl describe pod my-app-898f57d6f-dsfg6</code></li>
  </ul>
  <pre class="lang-sh prettyprint-override"><code>Name:         my-app-898f57d6f-dsfg6
  Namespace:    default
  Priority:     0
  Node:         ip-192-168-119-55.ec2.internal/192.168.119.55
  Start Time:   Sun, 12 Jul 2020 16:53:53 -0400
  Labels:       app=my-app
                pod-template-hash=898f57d6f
  Annotations:  kubernetes.io/psp: eks.privileged
  Status:       Running
  IP:           192.168.79.54
  IPs:
    IP:           192.168.79.54
  Controlled By:  ReplicaSet/my-app-898f57d6f
  Containers:
    simple-node:
      Container ID:   docker://cd6c686fe8f5460d5985a81a8d75da9c76371e26572b5144d5d43b55a0415ddd
      Image:          pythonss/ex1-node-app
      Image ID:       docker-pullable://pythonss/ex1-node-app@sha256:1ad843251ce45c21df4be52a34565217ea7cc441f2961d90c8e466af14473003
      Port:           80/TCP
      Host Port:      0/TCP
      State:          Running
        Started:      Sun, 12 Jul 2020 16:53:54 -0400
      Ready:          True
      Restart Count:  0
      Environment:    &lt;none&gt;
      Mounts:
        /var/run/secrets/kubernetes.io/serviceaccount from default-token-jm5s2 (ro)
  Conditions:
    Type              Status
    Initialized       True
    Ready             True
    ContainersReady   True
    PodScheduled      True
  Volumes:
    default-token-jm5s2:
      Type:        Secret (a volume populated by a Secret)
      SecretName:  default-token-jm5s2
      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>
  <pre><code>kubectl --namespace=kube-system get pods
  NAME                                         READY   STATUS    RESTARTS   AGE
  aws-node-j76qj                               1/1     Running   0          19h
  aws-node-sqrqq                               1/1     Running   0          19h
  aws-node-ws9kv                               1/1     Running   0          19h
  coredns-55c5fcd78f-2jvzg                     1/1     Running   0          25h
  coredns-55c5fcd78f-dlftl                     1/1     Running   0          25h
  kube-proxy-g9pbv                             1/1     Running   0          19h
  kube-proxy-wzfpc                             1/1     Running   0          19h
  kube-proxy-znptc                             1/1     Running   0          19h
  traefik-ingress-controller-5bdbcfc59-87rd8   1/1     Running   0          88m
  </code></pre>
  <p>I also applied the traefik manifest and at the same time  changed the LB type from NodePort to LoadBalancer</p>
  <pre class="lang-sh prettyprint-override"><code>kubectl apply -f &lt;(curl -so - https://raw.githubusercontent.com/containous/traefik/v1.7/examples/k8s/traefik-deployment.yaml | sed -e 's/NodePort/LoadBalancer/')
  </code></pre>
  <pre><code>kubectl get svc -n kube-system
  
  NAME                      TYPE           CLUSTER-IP       EXTERNAL-IP                                                              PORT(S)                       AGE
  kube-dns                  ClusterIP      10.100.0.10      &lt;none&gt;                                                                   53/UDP,53/TCP                 2d20h
  
  traefik-ingress-service   LoadBalancer   10.100.113.186   a262f21c7a0c740949c3321ab77a0259-639235071.us-east-1.elb.amazonaws.com   80:30015/TCP,8080:31515/TCP   44h
  </code></pre>
  <pre><code>host a262f21c7a0c740949c3321ab77a0259-639235071.us-east-1.elb.amazonaws.com
  a262f21c7a0c740949c3321ab77a0259-639235071.us-east-1.elb.amazonaws.com has address 107.22.153.204
  a262f21c7a0c740949c3321ab77a0259-639235071.us-east-1.elb.amazonaws.com has address 52.44.97.64
  a262f21c7a0c740949c3321ab77a0259-639235071.us-east-1.elb.amazonaws.com has address 34.195.130.205
  </code></pre>
  <p>I applied a hostname manifest so I could later do</p>
  <p>curl 34.195.130.205 hostname-v1.local</p>
  <p>as under</p>
  <p>hostname-ingress.yaml</p>
  <pre class="lang-yaml prettyprint-override"><code>---
  apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: hostname-ingress
    namespace: default
  spec:
    rules:
    - host: hostname-v1.local
      http:
        paths:
        - path: /
          backend:
            serviceName: my-app
            servicePort: web
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>kubectl create -f hostname-ingress.yaml
  # OUTPUT
  ingress.extensions/hostname-ingress created
  </code></pre>
  <p>Take INGRESS_ADDR and associate it with the domain name in /etc/hosts</p>
  <pre class="lang-sh prettyprint-override"><code>echo &quot;$INGRESS_ADDR hostname-v1.local&quot; | sudo tee -a /etc/hosts
  # OUTPUT
  34.195.130.205 hostname-v1.local
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>kubectl create -f hostname-ingress.yaml
  # OUTPUT
  ingress.extensions/hostname-ingress created
  </code></pre>
  <pre><code>kubectl get ep
  NAME          ENDPOINTS                               AGE
  hostname-v2   &lt;none&gt;                                  20h
  kubernetes    192.168.219.41:443,192.168.94.137:443   27h
  my-app        &lt;none&gt;                                  19h
  </code></pre>
  <p>Now let's take our INGRESS_ADDR and associate it with the hosts in etc/hosts</p>
  <pre class="lang-sh prettyprint-override"><code>echo &quot;$INGRESS_ADDR hostname-v1.local&quot; | sudo tee -a /etc/hosts
  # OUTPUT
  34.195.130.205 hostname-v1.local
  </code></pre>
  <p>Here is also service.yaml and deployment.yaml</p>
  <p>service.yaml</p>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
  kind: Service
  metadata:
    name: my-app
    labels:
      run: my-app
  spec:
    ports:
    - port: 80
      protocol: TCP
    selector:
      run: my-app
  
  </code></pre>
  <p>deployment.yaml</p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: my-app
    labels:
      app: my-app
  spec:
    replicas: 3
    selector:
      matchLabels:
        app: my-app
    template:
      metadata:
        labels:
          app: my-app
      spec:
        containers:
        - name: simple-node
          image: pythonss/ex1-node-app
          ports:
          - containerPort: 80
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code> kubectl get pods --show-labels |egrep 'app=my-app'                                                                 
  my-app-898f57d6f-dsfg6   1/1     Running   0          128m   app=my-app,pod-template-hash=898f57d6f
  my-app-898f57d6f-hchhb   1/1     Running   0          128m   app=my-app,pod-template-hash=898f57d6f
  my-app-898f57d6f-hh4cw   1/1     Running   0          128m   app=my-app,pod-template-hash=898f57d6f
  </code></pre>
  <p>And</p>
  <pre class="lang-sh prettyprint-override"><code>kubectl describe svc my-app   
                                                                                    
  Name:              my-app
  Namespace:         default
  Labels:            app=my-app
  Annotations:       &lt;none&gt;
  Selector:          app=my-app
  Type:              ClusterIP
  IP:                10.100.147.193
  Port:              &lt;unset&gt;  80/TCP
  TargetPort:        80/TCP
  Endpoints:         192.168.158.248:80,192.168.218.93:80,192.168.79.54:80
  Session Affinity:  None
  Events:            &lt;none&gt;
  </code></pre>
  <p>I can see <a href="http://hostname-v1.local:8080" rel="nofollow noreferrer">http://hostname-v1.local:8080</a></p>
  <p><a href="https://i.stack.imgur.com/GHH2l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GHH2l.png" alt="enter image description here" /></a></p>
  <p>I can even log in to one of the pod and see that the container is correctly running my app</p>
  <pre><code>kubectl exec -it my-app-898f57d6f-dsfg6 /bin/bash
  </code></pre>
  <pre><code>root@my-app-898f57d6f-dsfg6:/usr/src/app# curl localhost
  
  Hello World !!
  
  </code></pre>
  <p>But</p>
  <p><a href="http://hostname-v1.local" rel="nofollow noreferrer">http://hostname-v1.local</a></p>
  <p>shows</p>
  <p>SERVICE UNAVAILABLE</p>
  <p><strong>Question</strong>:</p>
  <p>Why is that I can not see my simple app running on:</p>
  <p><a href="http://hostname-v1.local" rel="nofollow noreferrer">http://hostname-v1.local</a> (34.195.130.205 )</p>
  <p>even though it is running inside the container?</p>
  <p>BR</p>