<p>I have my image hosted on GCR.
I deployed my application on local Kubernetes cluster(mac).
This is my deployment file -</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: sv-premier
spec:
  selector:
    matchLabels:
      app: sv-premier
  template:
    metadata:
      labels:
        app: sv-premier
    spec:
      volumes:
      - name: google-cloud-key
        secret:
          secretName: gcp-key
      containers:
      - name: sv-premier
        image: gcr.io/proto/premiercore1:latest
        imagePullPolicy: Always
        command: ["echo", "Done deploying sv-premier"]
        volumeMounts:
        - name: google-cloud-key
          mountPath: /var/secrets/google
        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /var/secrets/google/key.json
        ports:
        - containerPort: 8080
      imagePullSecrets:
      - name: imagepullsecretkey
</code></pre>

<p>I am trying to access the application but I am not able to.
I created the service as --> </p>

<pre><code>$ kubectl expose deployment sv-premier --port=8080 --target-port=8080
service/sv-premierleague exposed

$ kubectl get service sv-premier
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
sv-premier   ClusterIP   10.107.202.156   &lt;none&gt;        8080/TCP   58s
</code></pre>

<blockquote>
  <p>$ kubectl get all -o wide</p>
</blockquote>

<pre><code>NAME                              READY   STATUS    RESTARTS   AGE   IP          NODE             NOMINATED NODE   READINESS GATES
pod/sv-premier-6b695d5fd7-l4995   1/1     Running   0          21h   10.1.0.45   docker-desktop   &lt;none&gt;           &lt;none

NAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE   SELECTOR
service/kubernetes   ClusterIP   10.96.0.1        &lt;none&gt;        443/TCP    8d    &lt;none&gt;
service/sv-premier   ClusterIP   10.107.202.156   &lt;none&gt;        8080/TCP   23m   app=sv-premier

NAME                         READY   UP-TO-DATE   AVAILABLE   AGE   CONTAINERS   IMAGES                                    SELECTOR
deployment.apps/sv-premier   1/1     1            1           21h   sv-premier   gcr.io/sap-s4-proto/premiercore1:latest   app=sv-premier


NAME                                    DESIRED   CURRENT   READY   AGE   CONTAINERS   IMAGES                                    SELECTOR
replicaset.apps/sv-premier-6b695d5fd7   1         1         1       21h   sv-premier   gcr.io/sap-s4-proto/premiercore1:latest   app=sv-premierleague,pod-template-hash=6b695d5fd7
</code></pre>

<blockquote>
  <p>$ kubectl get nodes -o wide</p>
</blockquote>

<pre><code>NAME             STATUS   ROLES    AGE   VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE         KERNEL-VERSION     CONTAINER-RUNTIME
docker-desktop   Ready    master   8d    v1.15.5   192.168.65.3   &lt;none&gt;        Docker Desktop   4.19.76-linuxkit   docker://19.3.5
</code></pre>

<p>Now as mentioned <a href="https://stackoverflow.com/questions/59835323/how-to-access-kubernetes-deployment">here</a> in the accepted answer, I am trying to access my application like --
docker-desktop:NodePort i.e. 192.168.65.3:8080. But I am not able to.
<a href="https://i.stack.imgur.com/PUIfJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PUIfJ.png" alt="enter image description here"></a></p>

Maxx
<p>Update your command to include the type to expose service on nodeport</p>

<p><code>kubectl expose deployment sv-premier --port=8080 --type=NodePort</code></p>

<p>Then your should try to reach the service using ..  ip:nodeport combination</p>

<blockquote>
  <p>Are you using Google cloud ? The you should prefer service type=loadbalancer</p>
</blockquote>

<p>When you create a Service of type LoadBalancer, a Google Cloud controller auto configures a network load balancer. Wait a minute for the controller to configure the network load balancer and generate a stable IP address. Use details from the loadbalncer to access the service.</p>
