<p>I deployed kubernetes on my computer and config pod, service, ingress. I curl the domain that I configured but get <code>503</code> error. What's the reason?<br>
Operating System: Mac OSX 10.15.3<br>
Docker version: 19.03.8<br>
the pod:</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: opengateway
  namespace: openplatform
spec:
  containers:
    - name: opengateway
      image: "karldoenitz/opengateway:1.0"
      ports:
        - containerPort: 8000
          hostPort: 8000
      env:
        - name: etcdiport
          valueFrom:
            configMapKeyRef:
              name: openplatform
              key: etcd-iport
      imagePullPolicy: IfNotPresent
</code></pre>

<p>the service </p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: webgateway
  namespace: openplatform
spec:
  ports:
    - port: 8000
      targetPort: 8000
  selector:
    app: opengateway
</code></pre>

<p>the ingress</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: openplatform-web-gateway
  namespace: openplatform
spec:
  rules:
    - host: open.platform.com
      http:
        paths:
          - path: /
            backend:
              serviceName: webgateway
              servicePort: 8000
</code></pre>

<p>describe svc webgateway -n openplatform</p>

<pre><code>Name:              webgateway
Namespace:         openplatform
Labels:            &lt;none&gt;
Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                     {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"webgateway","namespace":"openplatform"},"spec":{"ports":[{"port":...
Selector:          app=opengateway
Type:              ClusterIP
IP:                10.109.103.73
Port:              &lt;unset&gt;  8000/TCP
TargetPort:        8000/TCP
Endpoints:         &lt;none&gt;
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>

<p>the log of ingress-controller :</p>

<pre><code>192.168.65.3 - - [26/Apr/2020:08:58:37 +0000] "GET /favicon.ico HTTP/1.1" 503 599 "http://open.platform.com/ping" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36" 388 0.000 [openplatform-openplatform-web-gateway-30001] [] - - - - 086d5a61011485f8fa69dca25afd93ae
</code></pre>

<p>all the pod, service, ingress is running.I run the command <code>curl http://open.platform.com</code>, I got error <code>503 Service Temporarily Unavailable</code>. What's the matter?</p>

<p>So the problem here is that the service has a label selector which selects pods with label  <code>app: opengateway</code> but the pods don't have this label. Because of this the <code>Endpoints</code> in the service is empty and does not have the POD IPs. Adding  label <code>app: opengateway</code> into the pod should solve it.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: opengateway
  namespace: openplatform
  labels:
    app: opengateway
spec:
  containers:
    - name: opengateway
      image: "karldoenitz/opengateway:1.0"
      ports:
        - containerPort: 8000
          hostPort: 8000
      env:
        - name: etcdiport
          valueFrom:
            configMapKeyRef:
              name: openplatform
              key: etcd-iport
      imagePullPolicy: IfNotPresent
</code></pre>
