Skip to content

Instantly share code, notes, and snippets.

@danmaas
Last active October 3, 2019 15:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danmaas/c432784885c29561be35be34fd67c88f to your computer and use it in GitHub Desktop.
Save danmaas/c432784885c29561be35be34fd67c88f to your computer and use it in GitHub Desktop.
Singleton ALB ingress controller fronting Nginx for Amazon EKS
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "myALB"
labels:
app: "myALBApp"
annotations:
# trigger the alb-ingress-controller
kubernetes.io/ingress.class: "alb"
# set ALB parameters
alb.ingress.kubernetes.io/scheme: "internet-facing"
alb.ingress.kubernetes.io/target-type: "instance"
alb.ingress.kubernetes.io/security-groups: my-security-group-ids, ...
alb.ingress.kubernetes.io/subnets: my-vpc-subnets, ...
alb.ingress.kubernetes.io/certificate-arn: my-acm-certificate-arn
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80,"HTTPS": 443}]'
# allow 404s on the health check
alb.ingress.kubernetes.io/healthcheck-path: "/"
alb.ingress.kubernetes.io/success-codes: "200,404"
spec:
# forward all requests to nginx-ingress-controller
rules:
- http:
paths:
- path: "/*"
backend:
serviceName: "nginx-ingress-controller"
servicePort: 80
@kekbur
Copy link

kekbur commented Nov 16, 2018

I believe the path on line 27 should be "/*".

@danmaas
Copy link
Author

danmaas commented May 1, 2019

Corrected, thank you @kekbur!

@stusklinar
Copy link

Is there a suitable full example for this? We tried this and found out nginx-controller was in its own namespace and thus neverfound...

@danmaas
Copy link
Author

danmaas commented Jun 11, 2019

Sorry, I don't have a complete example. Regarding namespaces, nginx-controller's Ingress routing can "see through" namespace boundaries (in the default configuration), so as long as the ALB can see nginx, then the underlying services can be in other namespaces.

@jfdoube
Copy link

jfdoube commented Oct 3, 2019

Following the example, I get failed to reconcile targetGroups due to failed to load serviceAnnotation due to no object matching key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment