<p>I'm going through <a href="https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/" rel="nofollow noreferrer">this</a> tutorial to create a deployment and an ingress controller on Minikube. When I run, as instructed in the tutorial, <code>curl --resolve &quot;hello-world.info:80:$( minikube ip )&quot; -i http://hello-world.info</code> I simply get <code>HTTP/1.1 503 Service Temporarily Unavailable</code>.</p>
<p>Here are my deployment, service, ingress and kustomization files:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: example-deployment
  labels:
    app: example
spec:
  replicas: 2
  selector:
    matchLabels:
      app: example
  template:
    metadata:
      labels:
        app: example
    spec:
      containers:
      - name: nginx
        image: localhost:5000/example-app:latest
        ports:
        - name: web
          containerPort: 80

---

apiVersion: v1
kind: Service
metadata:
  name: example
spec:
  ports:
    - name: web
      port: 80
      targetPort: web
  selector:
    app.kubernetes.io/name: example

---

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: hello-world.info
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: example
            port:
              number: 80

---

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
metadata:
  name: arbitrary

# Example configuration for the webserver
# at https://github.com/monopole/hello
commonLabels:
  app: example

resources:
- deployment.yaml
- service.yaml
- ingress.yaml


</code></pre>
<p>Here is the output from <code>kubectl get ingress</code>:</p>
<pre><code>NAME              CLASS   HOSTS              ADDRESS        PORTS   AGE
example-ingress   nginx   hello-world.info   192.168.49.2   80      3m29s
</code></pre>
<p>Here is the output from <code>kubectl get services</code>:</p>
<pre><code>kubectl get services
NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
example      ClusterIP   10.109.63.32   &lt;none&gt;        80/TCP    10m
</code></pre>
<p>So as you can see everything is up and running. Here is my nginx:</p>
<pre><code>[jenia@archlinux ibn-battuta]$ kubectl get pods -n ingress-nginx
NAME                                        READY   STATUS      RESTARTS   AGE
ingress-nginx-admission-create-fvj4v        0/1     Completed   0          3h37m
ingress-nginx-admission-patch-d4xfn         0/1     Completed   1          3h37m
ingress-nginx-controller-7799c6795f-7qgsr   1/1     Running     0          3h37m
</code></pre>
<p>Here are the logs of nginx 503:</p>
<pre><code>192.168.49.1 - - [29/Aug/2023:01:11:43 +0000] &quot;GET / HTTP/1.1&quot; 503 190 &quot;-&quot; &quot;curl/8.2.1&quot; 79 0.000 [default-example-80] [] - - - - e03c2a5e71db02f27f1afca0905c6c36
</code></pre>
<p>If anyone can help me, it'll be greatly appreciated.</p>

Jenia Ivanov
<p>@Jenia Ivanov</p>
<p><code>targetPort</code> is incorrect in your <code>example</code> service</p>
<p><code>selector</code> in <code>example</code> service doesnot match the <code>label</code> of your <code>pod</code> in your <code>deployment yaml</code></p>
<p>Could you update  <code>targetPort</code> and <code>selector</code> in your service  as shown below and verify?</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: example
spec:
  ports:
    - name: web
      port: 80
      targetPort: 80
  selector:
    app: example
</code></pre>
