<h1>What do i have working</h1>

<p>I have a Kubernetes cluster as follow:</p>

<ul>
<li>Single control plane (but plan to extend to 3 control plane for HA)</li>
<li>2 worker nodes</li>
</ul>

<p><br><br>
On this cluster i deployed (following this doc from traefik <a href="https://docs.traefik.io/user-guides/crd-acme/" rel="nofollow noreferrer">https://docs.traefik.io/user-guides/crd-acme/</a>):</p>

<ul>
<li><p>A deployment that create two pods :</p>

<ul>
<li>traefik itself: which will be in charge of routing with exposed port 80, 8080</li>
<li>whoami:a simple http server thats responds to http requests</li>
</ul></li>
<li><p>two services</p>

<ul>
<li>traefik service: <a href="https://i.stack.imgur.com/U1Zub.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U1Zub.png" alt=""></a></li>
<li>whoami servic: <a href="https://i.stack.imgur.com/hoIQt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hoIQt.png" alt=""></a></li>
</ul></li>
<li><p>One traefik IngressRoute:
<a href="https://i.stack.imgur.com/x5OIW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x5OIW.png" alt=""></a></p></li>
</ul>

<h1>What do i want</h1>

<p>I have multiple services running in the cluster and i want to expose them to the outside using Ingress.
More precisely i want to use the new <strong>Traefik 2.x</strong> CDR ingress methods.</p>

<p>My ultimate goal is to use new traefiks 2.x CRD to expose resources on port 80, 443, 8080 using <code>IngressRoute</code> Custom resource definitions</p>

<h1>What's the problem</h1>

<p>If i understand well, classic Ingress controllers allow exposition of every ports we want to the outside world (including 80, 8080 and 443).</p>

<p>But with the new traefik CDR ingress approach on it's own it does not exports anything at all.
One solution is to define the Traefik service as a loadbalancer typed service and then expose some ports. But you are forced to use the 30000-32767 ports range (same as nodeport), and i don't want to add a reverse proxy in front of the reverse proxy to be able to expose port 80 and 443...</p>

<p>Also i've seed from the doc of the new igress CRD (<a href="https://docs.traefik.io/user-guides/crd-acme/" rel="nofollow noreferrer">https://docs.traefik.io/user-guides/crd-acme/</a>) that:</p>

<p><code>kubectl port-forward --address 0.0.0.0 service/traefik 8000:8000 8080:8080 443:4443 -n default</code></p>

<p>is required, and i understand that now. You need to map the host port to the service port.
But mapping the ports that way feels clunky and counter intuitive. I don't want to have a part of the service description in a yaml and at the same time have to remember that i need to map port with <code>kubectl</code>.</p>

<p>I'm pretty sure there is a neat and simple solution to this problem, but i can't understand how to keep things simple. Do you guys have an experience in kubernetes with the new traefik 2.x CRD config?</p>

<p>You can try to use LoadBalancer service type for expose the Traefik service on ports 80, 443 and 8080. I've tested the yaml from the link you provided in GKE, and it's works.</p>

<p>You need to change the ports on 'traefik' service and add a 'LoadBalancer' as service type:</p>

<pre><code>kind: Service
metadata:
  name: traefik
spec:
  ports:
    - protocol: TCP
      name: web
      port: 80 &lt;== Port to receive HTTP connections
    - protocol: TCP
      name: admin
      port: 8080 &lt;== Administration port
    - protocol: TCP
      name: websecure
      port: 443 &lt;== Port to receive HTTPS connections
  selector:
    app: traefik
  type: LoadBalancer &lt;== Define the type load balancer
</code></pre>

<p>Kubernetes will create a Loadbalancer for you service and you can access your application using ports 80 and 443.</p>

<pre><code>$ curl https://35.111.XXX.XX/tls -k
Hostname: whoami-5df4df6ff5-xwflt
IP: 127.0.0.1
IP: 10.60.1.11
RemoteAddr: 10.60.1.13:55262
GET /tls HTTP/1.1
Host: 35.111.XXX.XX
User-Agent: curl/7.66.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 10.60.1.1
X-Forwarded-Host: 35.111.XXX.XX
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Forwarded-Server: traefik-66dd84c65c-4c5gp
X-Real-Ip: 10.60.1.1

$ curl http://35.111.XXX.XX/notls   
Hostname: whoami-5df4df6ff5-xwflt
IP: 127.0.0.1
IP: 10.60.1.11
RemoteAddr: 10.60.1.13:55262
GET /notls HTTP/1.1
Host: 35.111.XXX.XX
User-Agent: curl/7.66.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 10.60.1.1
X-Forwarded-Host: 35.111.XXX.XX
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: traefik-66dd84c65c-4c5gp
X-Real-Ip: 10.60.1.1
</code></pre>
