Skip to content

Instantly share code, notes, and snippets.

@ams0
Created May 15, 2025 11:53
Show Gist options
  • Save ams0/3184062eaca5b66d677bcb6c82a46645 to your computer and use it in GitHub Desktop.
Save ams0/3184062eaca5b66d677bcb6c82a46645 to your computer and use it in GitHub Desktop.
A full example of GatewayAPI with HTTPS, cert-manager, external-dns in AKS. Note the annotations!
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: public-gateway
namespace: istio-system
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
infrastructure:
annotations:
service.beta.kubernetes.io/port_443_health-probe_protocol: tcp
service.beta.kubernetes.io/port_80_health-probe_protocol: tcp
gatewayClassName: istio # or your controller’s gateway class name
listeners:
- name: https
hostname: "*.test.ne.azure.kubespaces.cloud"
protocol: HTTPS
port: 443
allowedRoutes:
namespaces:
from: All
tls:
mode: Terminate
certificateRefs:
- name: test-wildcard-tls
- name: http
protocol: HTTP
port: 80
hostname: "*.test.ne.azure.kubespaces.cloud"
allowedRoutes:
namespaces:
from: All
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: nginx-route-https
namespace: default
annotations:
external-dns.alpha.kubernetes.io/hostname: aks.test.ne.azure.kubespaces.cloud
spec:
hostnames:
- aks.test.ne.azure.kubespaces.cloud
parentRefs:
- name: public-gateway
namespace: istio-system
sectionName: https # matches listener name in the Gateway
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: nginx
port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: nginx-route-http
namespace: default
spec:
parentRefs:
- name: public-gateway
namespace: istio-system
sectionName: http
hostnames:
- aks.test.ne.azure.kubespaces.cloud
rules:
- filters:
- type: RequestRedirect
requestRedirect:
scheme: https
statusCode: 301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment