<p>I am doing my practice on <strong>Kubernetes</strong> through <strong>Minikube</strong> on my <strong>AWS EC2</strong>. As part of that, I have created <strong>deployment</strong> and exposed that through <strong>NodePort</strong> service, then checked with:</p>
<pre><code>curl http://&lt;node-ip&gt;:&lt;service-port&gt;
</code></pre>
<p>in EC2 Machine that worked fine. But when I hit the same URL on browser gave me:</p>
<pre><code>This site can't be reached
</code></pre>
<p>Can anyone help me what is the problem and how can I access this?</p>
<p>Thank you.</p>
<p>This is my Deployment YAML file:</p>
<pre>
<code>
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myfirstdeployment
  labels:
    app: web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      name: myfirstpod
      labels:
        app: web
    spec:
      containers:
      - name: myfirstpod-1
        image: nginx
        command: ["sleep","3600"]
        ports:
        - containerPort: 80
</code>
</pre>
<p>This is my Service YAML file</p>
<pre>
<code>
apiVersion: v1
kind: Service
metadata:
  name: myfirstservice
spec:
  selector:
    app: web
  ports:
  - targetPort: 80 #target container's port
    port: 80 #service port
    nodePort: 30030 #node port that we access to
  type: NodePort
</code>
</pre>

<p>I strongly recommend going through the official tutorial showing the <a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/" rel="noreferrer">Accessing apps</a> options in Minikube:</p>
<blockquote>
<p>How to access applications running within minikube There are two major
categories of services in Kubernetes:</p>
<ul>
<li>NodePort</li>
<li>LoadBalancer</li>
</ul>
<p>minikube supports either. Read on!</p>
</blockquote>
<p>There you will find how to use both, the <a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/#nodeport-access" rel="noreferrer">NodePort access</a>:</p>
<blockquote>
<p>A <code>NodePort</code> service is the most basic way to get external traffic
directly to your service. <code>NodePort</code>, as the name implies, opens a
specific port, and any traffic that is sent to this port is forwarded
to the service.</p>
</blockquote>
<p>Notice that you have to use <code>minikube ip</code> here.</p>
<p>And also the <a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/#loadbalancer-access" rel="noreferrer">LoadBalancer access</a>:</p>
<blockquote>
<p>A <code>LoadBalancer</code> service is the standard way to expose a service to the
internet. With this method, each service gets its own IP address.</p>
</blockquote>
<p>This method uses the <code>minikube tunnel</code> command.</p>
<p>You can also use <a href="https://kubernetes.io/docs/tutorials/hello-minikube/" rel="noreferrer">these docs</a> as a supplement.</p>
