Skip to content
imlostincode
ENNL
Deployment kit

astro-k8s-deployment-kit

Shared deploy setup for Astro sites. Fix it once, and every site picks it up on its next update.

UnreleasedYou're reading the docs from main. Things here can change before the next release.Back to the latest release →
examples / main

overlay-production/ingress.yaml

View on GitHub ↗ (opens in a new tab)
yaml
# Project-specific: hostnames, ingress flavour, middlewares are all yours.
# This example uses Traefik IngressRoute; swap for a plain Ingress if that's
# what your cluster runs (then kustomizeconfig.yaml is unnecessary).
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: app-http
  labels:
    app.kubernetes.io/component: ingress
spec:
  entryPoints:
    - web
  routes:
    # ACME HTTP-01 challenges must not be redirected, so they get their own
    # higher-priority rule.
    # Parentheses matter: && binds tighter than ||, so without them this would
    # read as `Host(example.com) || (Host(www…) && PathPrefix(…))`.
    - match: (Host(`example.com`) || Host(`www.example.com`)) && PathPrefix(`/.well-known/acme-challenge`)
      kind: Rule
      priority: 100
      services:
        - name: app
          port: 80
    - match: Host(`example.com`) || Host(`www.example.com`)
      kind: Rule
      priority: 10
      services:
        - name: app
          port: 80
      middlewares:
        - name: redirect-to-https
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: app-https
  labels:
    app.kubernetes.io/component: ingress
spec:
  entryPoints:
    - websecure
  routes:
    - match: Host(`example.com`) || Host(`www.example.com`)
      kind: Rule
      services:
        - name: app
          port: 80
  tls:
    secretName: app-tls