Basic IngressRoute
The simplest Traefik IngressRoute — route all traffic for a hostname to a single service.
Prerequisites
Your app needs a Deployment and Service enabled:
base/base-values.yaml
image:
registry: docker.io
repository: traefik/whoami
tag: latest
port: 80
Configuration
- customResources (list)
- customResourcesMap (map)
envs/prod/values.yaml
deployment:
enabled: true
replicas: 1
service:
enabled: true
customResources:
- |
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: my-app
annotations:
kubernetes.io/ingress.class: public-traefik
external-dns.alpha.kubernetes.io/target: public-v2.{{ .Values.captain_domain }}
spec:
entryPoints:
- web
- websecure
routes:
- match: Host(`{{ include "app.name" . }}.apps.{{ .Values.captain_domain }}`)
kind: Rule
services:
- name: '{{ include "app.name" . }}'
namespace: '{{ include "app.namespace" . }}'
port: 80
envs/prod/values.yaml
deployment:
enabled: true
replicas: 1
service:
enabled: true
customResourcesMap:
ingressroute: |
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: my-app
annotations:
kubernetes.io/ingress.class: public-traefik
external-dns.alpha.kubernetes.io/target: public-v2.{{ .Values.captain_domain }}
spec:
entryPoints:
- web
- websecure
routes:
- match: Host(`{{ include "app.name" . }}.apps.{{ .Values.captain_domain }}`)
kind: Rule
services:
- name: '{{ include "app.name" . }}'
namespace: '{{ include "app.namespace" . }}'
port: 80
What Gets Created
| Resource | Name | Purpose |
|---|---|---|
| Deployment | my-app-prod | Runs the application pods |
| Service | my-app-prod | ClusterIP service for internal routing |
| IngressRoute | my-app | Routes external traffic to the service |
Verify
curl https://my-app-prod.apps.nonprod.antoniostacos.onglueops.com
note
The -prod suffix matches your environment folder name (envs/prod/). If you deploy to a different environment like envs/uat/, the suffix changes accordingly (e.g., my-app-uat).
Key Points
- The
kubernetes.io/ingress.class: public-traefikannotation tells Traefik to handle this IngressRoute - The
external-dns.alpha.kubernetes.io/targetannotation creates the DNS record pointing to the load balancer - The service name must match the ArgoCD app name:
<app-folder>-<env-folder>(e.g.,my-app-prod) - Both
webandwebsecureentrypoints are included so the app is reachable on both HTTP and HTTPS