Skip to content

Instantly share code, notes, and snippets.

@tomellis
Created June 27, 2020 15:23
Show Gist options
  • Save tomellis/c6680e29daaf559783b57d78f42a919d to your computer and use it in GitHub Desktop.
Save tomellis/c6680e29daaf559783b57d78f42a919d to your computer and use it in GitHub Desktop.
Example Kubernetes ingress for 2048 with https, acm certs, multiple alb-ingress-controller listener ports, redirect from port 80->443 and external-dns domain creation
# https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/alb-ingress.md
# If external-dns is configured for ingresses it will create the route53 hosted record for the domain in the host section below
# ACM certificate needs to be created outside of k8s
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "2048-ingress"
namespace: "2048-game"
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:eu-west-1:1234567890:certificate/aa123456-aa12-1a23-123a-abcd1234ef56
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
alb.ingress.kubernetes.io/actions.ssl-redi{ect: '{"Ty}e": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
labels:
app: 2048-ingress
spec:
rules:
- host: 2048.example.com
http:
paths:
- path: /*
backend:
serviceName: ssl-redirect
servicePort: use-annotation
- path: /*
backend:
serviceName: "service-2048"
servicePort: 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment