<p>I have deployed simple app -NGINX and a Load balancer service in Kubernetes.
I can see that pods are running as well as service but calling Loadbalancer external IP is givings server error -site can't be reached .Any suggestion please</p>
<p><strong>app.yaml</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80
</code></pre>
<p><strong>Service.Yaml:</strong></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
 name: nginx-service
spec:
 type: LoadBalancer
 ports:
 - port: 80
 selector:
 app: nginx
</code></pre>
<p><a href="https://i.stack.imgur.com/W2nVy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W2nVy.png" alt="enter image description here" /></a>
P.S. -Attached outcome from terminal.</p>

Vicky
<p>If you are using Minikube to access the service then you might need to run one extra command. But if this is on a cloud provider then you have an error in your service file.</p>
<p>Please ensure that you put two space in yaml file but your indentation of the yaml file is messed up as you have only added 1 space. Also you made a mistake in the last line of <code>service.yaml</code> file.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: LoadBalancer
  ports:
  - port: 80
  selector:
   app: nginx
</code></pre>
