Using Cloudflare Tunnels to Route Directly to Your Ingress Controller
You should at this time know cloudflare tunnels, which are tunnels that expose
your internal services without opening ports in your router, but i saw very
little about using them in a k8s environment using an ingress, which i had done
and i will explain to you here.
The first step is this one
,check this out directly from cloudflare.
Well when you have been done this, is time to connect this to connect this to
our ingress controller to expose all you want to expose using an ingress,
directly from k8s throught the cloudflare tunnel
On the last part of the manifest they gave you to deploy the service, we need
to modify some things:
1 | --- |
On the ingress part, we are going to change what you got, for this:
1 | ingress: |
See the change?
Now, all the traffic that goes to host1, host2 and run.level5.dev are properly routed
to the ingress controller, which is traefik.
This is what i got for this blog
1 | > k describe ingress static-website -n website |
There is one thing that at the moment doesnt work: using wildcards on the ingress
part of the cloudflared file. When it works, you only need to configure a
wildcard there and cloudflare will route all to your ingress.
Bonus, you get a certificate for FREE on cloudflare behalf and you dont need
to worry ANYMORE about certificate expiration / renewal.
easy peasy!