Configure query base routing in AWS ALB ingress controller

Kun-Hung Tsai
1 min readMar 14, 2022

AWS Application Load Balancer provides user with the ability to do advanced request routing using query parameter.

However, it’s not explicitly mentioned how to do it with K8S ingress annotation in ALB ingress controller documentation. I found a Github issue discussing about advanced routing rules, but the information doesn’t include the configuration for query based routing.

After several search and tests, I was able to achieve query based routing through the following configuration. Basically two ALB ingress controller annotations were used:
alb.ingress.kubernetes.io/actions: used to control the behavior of traffic
alb.ingress.kubernetes.io/conditions: used to specify the routing rule

P.S. I am using EKS v1.20 with ALB ingress controller v2.3.1.

The above config would create an ALB with two routing paths as following:
query string path:nginx1 -> nginx-path1 k8s service
query string path:nginx2 -> nginx-path2 k8s service

That’s all. Feel free to share your thoughts or questions in the comment.

--

--