<p>I'm very new to kubernetes. I have spent the last week learning about Nodes, Pods, Clusters, Services, and Deployments.</p>
<p>With that I'm trying to just get some more understanding of how the networking for kubernetes even works. I just want to expose a simple nginx docker webpage and hit it from my browser.</p>
<p>Our VPC is setup with a direct connect so I'm able to hit EC2 instances on their private IP addresses. I also setup the EKS cluster using the UI on aws for now as <code>private</code>. For testing purposes I have added my cidr range to be allowed on all TCP as an additional security group in the EKS cluster UI.</p>
<p>Here is my basic service and deployment definitions:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: testing-nodeport
  namespace: default
  labels:
    infrastructure: fargate
    app: testing-app
spec:
  type: NodePort
  selector:
    app: testing-app
  ports:
    - port: 80
      targetPort: testing-port
      protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: testing-deployment
  namespace: default
  labels:
    infrastructure: fargate
    app: testing-app
spec:
  replicas: 1
  selector:
    matchLabels:
      infrastructure: fargate
      app: testing-app
  template:
    metadata:
      labels:
        infrastructure: fargate
        app: testing-app
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - name: testing-port
          containerPort: 80
</code></pre>
<p>I can see that everything is running correctly when I run:</p>
<p><code>kubectl get all -n default</code></p>
<p>However, when I try to hit the NodePort IP address on port <code>80</code> I can't load it from the browser.</p>
<p>I can hit the pod if I first setup a <code>kubectl proxy</code> at the following url (as the proxy is started on port <code>8001</code>):</p>
<pre><code>http://localhost:8001/api/v1/namespaces/default/services/testing-nodeport:80/proxy/
</code></pre>
<p>I'm pretty much lost at this point. I don't know what I'm doing wrong and why I can't hit the basic nginx docker outside of the kubectl proxy command.</p>

wesleywh
<p>What if you use the <code>proxy</code> option? Something like this:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl port-forward -n default service/testing-nodeport 3000:80
Forwarding from 127.0.0.1:3000 -&gt; 80
Forwarding from [::1]:3000 -&gt; 80
</code></pre>
<p>After this, you can access your K8S service from <code>localhost:3000</code>. More info <a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/" rel="nofollow noreferrer">here</a></p>
