> For the complete documentation index, see [llms.txt](https://academy.cegedim.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.cegedim.cloud/francais/calcul/conteneurs-k8s/k8s-architecture/gateway-api/gateway-api-traefik.md).

# Traefik

Démarrage avec Traefik sur cegedim.cloud — déploiement de workloads avec IngressRoute

Traefik v3 supporte la Kubernetes Gateway API nativement. Il propose également son propre CRD `IngressRoute` pour les équipes qui préfèrent le routage natif Traefik. Ce guide utilise `IngressRoute` comme point d'entrée pratique.

{% embed url="<https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/>" %}

## Ce que la plateforme fournit

Vous n'avez pas besoin d'installer ou de configurer Traefik. Les composants suivants sont déployés et gérés par l'équipe plateforme :

| Composant            | Rôle                                                                   |
| -------------------- | ---------------------------------------------------------------------- |
| Contrôleur Traefik   | Surveille les ressources IngressRoute/HTTPRoute à l'échelle du cluster |
| Point d'entrée `web` | Point d'entrée HTTP — reçoit le trafic transféré par le F5 BigIP       |

Chaque cluster cegedim.cloud est fronté par un load balancer **F5 BigIP** qui gère le DNS wildcard (`*.{{ cluster-name }}.ccs.cegedim.cloud`), la terminaison TLS et le forwarding L4 vers les pods Traefik. Remplacez `{{ cluster-name }}` par le nom réel de votre cluster (ex. `prod-paris`, `staging-lyon`) dans tous les exemples ci-dessous.

## Déployer votre application

### Prérequis

* Traefik est installé sur votre cluster (disponible auprès de l'équipe plateforme via ITCare)

### Étape 1 — Déployer votre workload

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-web
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx-web
  template:
    metadata:
      labels:
        app: nginx-web
    spec:
      containers:
      - name: nginx
        image: nginx:stable
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-web
spec:
  selector:
    app: nginx-web
  ports:
  - port: 80
    targetPort: 80
```

### Étape 2 — Créer l'IngressRoute

```yaml
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: nginx-web
spec:
  entryPoints:
    - web
  routes:
    - match: Host(`nginx-web.{{ cluster-name }}.ccs.cegedim.cloud`)
      kind: Rule
      services:
        - name: nginx-web
          port: 80
```

### Étape 3 — Vérifier

```bash
# Vérifier le statut de l'IngressRoute
kubectl get ingressroute nginx-web

# Tester le point d'accès
curl https://nginx-web.{{ cluster-name }}.ccs.cegedim.cloud/
```

## Alternative : Gateway API HTTPRoute

Si vous préférez utiliser la Kubernetes Gateway API standard plutôt que l'`IngressRoute` natif Traefik, Traefik v3 supporte nativement les `HTTPRoute`. La plateforme fournit une Gateway `traefik-int` pour le trafic interne.

```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: nginx-web
spec:
  parentRefs:
  - name: traefik-int
  hostnames:
  - "nginx-web.{{ cluster-name }}.ccs.cegedim.cloud"
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /
    backendRefs:
    - name: nginx-web
      port: 80
```

```bash
# Vérifier le statut de l'HTTPRoute
kubectl get httproute nginx-web

# Tester le point d'accès
curl https://nginx-web.{{ cluster-name }}.ccs.cegedim.cloud/
```

## Nettoyage

Si vous avez utilisé IngressRoute :

```bash
kubectl delete ingressroute nginx-web
kubectl delete service nginx-web
kubectl delete deployment nginx-web
```

Si vous avez utilisé HTTPRoute :

```bash
kubectl delete httproute nginx-web
kubectl delete service nginx-web
kubectl delete deployment nginx-web
```

## Pour aller plus loin

{% embed url="<https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/>" %}

{% embed url="<https://gateway-api.sigs.k8s.io/>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://academy.cegedim.cloud/francais/calcul/conteneurs-k8s/k8s-architecture/gateway-api/gateway-api-traefik.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
