I am deploying K8S to AWS EKS cluster and use ALB for the deployments. I'd like to use one ALB for multiple services but I can't figure out how to share the same ALB. Every time I deploy a ingress it will override an existing one.
I have two config yaml file:
a.yaml
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: sample-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/group.name: sample-ingress
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/group.order: '1'
spec:
rules:
- http:
paths:
- path: /sample-app/*
backend:
serviceName: sample-entrypoint
servicePort: 80
b.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: sample-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/group.name: sample-ingress
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/group.order: '2'
spec:
rules:
- http:
paths:
- path: /sample-es/*
backend:
serviceName: sample-es-entrypoint
servicePort: 9200
I'd like both share the same ALB so I specify the group name to be the same:
alb.ingress.kubernetes.io/group.name: sample-ingress
I also specify a different order in the two files.
but when I run kubectl apply -f a.yaml, It creates a ALB with the rule I specified in the config file: /sample-app/*. But when I run kubectl apply -f b.yaml, it overrides the existing rule with /sample-es/*. So how can I make both share the same ALB and allow them provide different rules?