<p>I have created web deployment and service on kubernetes
When i list the service with <code>$ kubectl get service</code> command to list IP and Port to access the webpage but when i try to access it the site cant be reached.
It seem if kubernetes on minikube didnt pull image from docker hub..</p>
<p>Here my example script..
I use Kubernetes v1.19.2 with default driver Docker 19.03.8</p>
<ol>
<li><code>$ kubectl create -f web-pets.yaml</code></li>
</ol>
<blockquote>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pets
      service: web
  template:
    metadata:
      labels:
        app: pets
        service: web
    spec:
      containers:
      - image: nginx:alpine-1.19.2
        name: web
        ports:
        - containerPort: 80
          protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  type: NodePort
  ports:
  - port: 80
    protocol: TCP
  selector:
    app: pets
    service: web
</code></pre>
</blockquote>
<ol start="2">
<li>Output create <code>web-pets.yaml</code></li>
</ol>
<blockquote>
<pre><code>$ kubectl create -f web-pets.yaml
deployment.apps/web created
service/web created
</code></pre>
</blockquote>
<ol start="3">
<li>Output <code>$ kubectl get service</code></li>
</ol>
<blockquote>
<pre><code>$ kubectl get service
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP   10.96.0.1        &lt;none&gt;        443/TCP        11h
web          NodePort    10.110.107.234   &lt;none&gt;        80:30100/TCP   41s
</code></pre>
</blockquote>
<ol start="4">
<li>Output <code>$ kubectl get service web</code></li>
</ol>
<blockquote>
<pre><code>Name:                     web
Namespace:                default
Labels:                   &lt;none&gt;
Annotations:              &lt;none&gt;
Selector:                 app=pets,service=web
Type:                     NodePort
IP:                       10.109.10.68
Port:                     &lt;unset&gt;  3000/TCP
TargetPort:               3000/TCP
NodePort:                 &lt;unset&gt;  31830/TCP
Endpoints:                &lt;none&gt;
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>
</blockquote>
<ol start="5">
<li>When list all docker images no nginx image</li>
</ol>
<blockquote>
<pre><code>$ docker images
REPOSITORY                     TAG                 IMAGE ID      CREATED       SIZE
kicbase/stable                 v0.0.12-snapshot3   25ac91b9c8d7  4 weeks ago   952MB
gcr.io/k8s-minikube/kicbase    v0.0.12-snapshot3   25ac91b9c8d7  4 weeks ago   952MB
</code></pre>
</blockquote>
<ol start="6">
<li>Deploy web description</li>
</ol>
<blockquote>
<pre><code>$ kubectl describe deploy web
Name:                   web
Namespace:              default
CreationTimestamp:      Thu, 24 Sep 2020 17:25:42 +0700
Labels:                 &lt;none&gt;
Annotations:            &lt;none&gt;
Selector:               app=pets,service=web
Replicas:               1 desired | 0 updated | 0 total | 0 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=pets
           service=web
  Containers:
   web:
    Image:        nginx:alpine-1.19.2
    Port:         3000/TCP
    Host Port:    0/TCP
    Environment:  &lt;none&gt;
    Mounts:       &lt;none&gt;
  Volumes:        &lt;none&gt;
OldReplicaSets:   &lt;none&gt;
NewReplicaSet:    &lt;none&gt;
Events:           &lt;none&gt;
</code></pre>
</blockquote>
<ol start="7">
<li><code>$ kubectl get pods</code></li>
</ol>
<blockquote>
<pre><code>$ kubectl get pods
No resources found in default namespace.
</code></pre>
</blockquote>
<ol start="8">
<li><code>$ kubectl get events</code></li>
</ol>
<blockquote>
<pre><code>LAST SEEN   TYPE     REASON                    OBJECT          MESSAGE
7m13s       Normal   Starting                  node/minikube   Starting kubelet.
7m11s       Normal   NodeHasSufficientMemory   node/minikube   Node minikube status is now: NodeHasSufficientMemory
7m11s       Normal   NodeHasNoDiskPressure     node/minikube   Node minikube status is now: NodeHasNoDiskPressure
7m11s       Normal   NodeHasSufficientPID      node/minikube   Node minikube status is now: NodeHasSufficientPID
7m12s       Normal   NodeAllocatableEnforced   node/minikube   Updated Node Allocatable limit across pods
6m28s       Normal   Starting                  node/minikube   Starting kube-proxy.
</code></pre>
</blockquote>

Panji Setya Nur Prawira
<p>Nginx listens on port <code>80</code>. Hence you need to use port <code>80</code> instead of port <code>3000</code> in the deployment and service. From the <a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/" rel="nofollow noreferrer">docs</a> you should be able to access it using
<code>minikube service web</code></p>
