<h1>Notes</h1>

<p>I am trying to deploy a service and ingress for a demo service (from 'Kubernetes in Action') to an AWS EKS cluster in which the <code>traefik</code> ingress controller has been Helm installed.</p>

<p>I am able to access the traefik dashboard from the <code>traefik.example.com</code> hostname after manually adding the IP address of the AWS ELB provisioned by <code>traefik</code> to that hostname in my local <code>/etc/hosts</code> file.</p>

<p>If I describe the service and ingress of the <code>traefik-dashboard</code>:</p>

<pre><code>$ kubectl describe svc -n kube-system traefik-dashboard
Name:              traefik-dashboard
Namespace:         kube-system
Labels:            app=traefik
                   chart=traefik-1.52.6
                   heritage=Tiller
                   release=traefik
Annotations:       &lt;none&gt;
Selector:          app=traefik,release=traefik
Type:              ClusterIP
IP:                10.100.164.81
Port:              &lt;unset&gt;  80/TCP
TargetPort:        8080/TCP
Endpoints:         172.31.27.70:8080
Session Affinity:  None
Events:            &lt;none&gt;

$ kubectl describe ing -n kube-system traefik-dashboard
Name:             traefik-dashboard
Namespace:        kube-system
Address:
Default backend:  default-http-backend:80 (&lt;none&gt;)
Rules:
Host                 Path  Backends
----                 ----  --------
traefik.example.com
                        traefik-dashboard:80 (172.31.27.70:8080)
Annotations:
Events:  &lt;none&gt;
</code></pre>

<p>The service and ingress controller seem to be using the running <code>traefik-575cc584fb-v4mfn</code> pod in the <code>kube-system</code> namespace.</p>

<p>Given this info and looking at the traefik docs, I try to expose a demo service through its ingress with the following YAML:</p>

<pre><code>apiVersion: apps/v1beta2
kind: ReplicaSet
metadata:
name: kubia
spec:
replicas: 3
selector:
    matchLabels:
    app: kubia
template:
    metadata:
    labels:
        app: kubia
    spec:
    containers:
    - name: kubia
        image: luksa/kubia

---

apiVersion: v1
kind: Service
metadata:
name: kubia
namespace: default
spec:
selector:
    app: traefik
    release: traefik
ports:
- name: web
    port: 80
    targetPort: 8080

---

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: kubia
namespace: default
spec:
rules:
- host: kubia.int
    http:
    paths:
    - path: /
        backend:
        serviceName: kubia
        servicePort: web
</code></pre>

<p>After applying this, I am unable to access the <code>kubia</code> service from the <code>kubia.int</code> hostname after manually adding the IP address of the AWS ELB provisioned by <code>traefik</code> to that hostname in my local <code>/etc/hosts</code> file.  Instead, I get a <code>Service Unavailable</code> in the response.  Describing the created resources shows some differing info.</p>

<pre><code>$ kubectl describe svc kubia
Name:              kubia
Namespace:         default
Labels:            &lt;none&gt;
Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                    {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"kubia","namespace":"default"},"spec":{"ports":[{"name":"web","por...
Selector:          app=traefik,release=traefik
Type:              ClusterIP
IP:                10.100.142.243
Port:              web  80/TCP
TargetPort:        8080/TCP
Endpoints:         &lt;none&gt;
Session Affinity:  None
Events:            &lt;none&gt;

$ kubectl describe ing kubia
Name:             kubia
Namespace:        default
Address:
Default backend:  default-http-backend:80 (&lt;none&gt;)
Rules:
Host       Path  Backends
----       ----  --------
kubia.int
            /   kubia:web (&lt;none&gt;)
Annotations:
kubectl.kubernetes.io/last-applied-configuration:  {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{},"name":"kubia","namespace":"default"},"spec":{"rules":[{"host":"kubia.int","http":{"paths":[{"backend":{"serviceName":"kubia","servicePort":"web"},"path":"/"}]}}]}}

Events:  &lt;none&gt;
</code></pre>

<p>I also notice that the demo <code>kubia</code> service has no endpoints, and the corresponding ingress shows no available backends.</p>

<p>Another thing I notice is that the demo <code>kubia</code> service and ingress is in the <code>default</code> namespace, while the <code>traefik-dashboard</code> service and ingress are in the <code>kube-system</code> namespace.</p>

<p>Does anything jump out to anyone?  Any suggestions on the best way to diagnose it?</p>

<p>Many thanks in advance!</p>

<p>It would seem that you are missing the <code>kubernetes.io/ingress.class: traefik</code> that tells your Traefik ingress controller to serve for that Ingress definition.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubia
  namespace: default
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
rules:
- host: kubia.int
    http:
    paths:
    - path: /
        backend:
        serviceName: kubia
        servicePort: web
</code></pre>

<p>If you look at the examples in the <a href="https://docs.traefik.io/user-guide/kubernetes/" rel="nofollow noreferrer">docs</a> you can see that the only Ingress that doesn't have annotation is <code>traefik-web-ui</code> that points to the Traefik Web UI.</p>
