basicstack.org/k8s/30-ingress.yaml

51 lines
1.3 KiB
YAML
Raw Normal View History

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: basicstack-web
namespace: basicstack-web
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
cert-manager.io/cluster-issuer: letsencrypt-prod
traefik.ingress.kubernetes.io/router.middlewares: basicstack-web-redirect@kubernetescrd
spec:
ingressClassName: traefik
tls:
- hosts:
- basicstack.org
- www.basicstack.org
secretName: basicstack-org-tls
rules:
- host: basicstack.org
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: basicstack-web
port:
number: 80
- host: www.basicstack.org
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: basicstack-web
port:
number: 80
---
# Redirect www to non-www
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: redirect
namespace: basicstack-web
spec:
redirectRegex:
regex: "^https://www\\.basicstack\\.org/(.*)"
replacement: "https://basicstack.org/${1}"
permanent: true