aws-load-balancer-controller
aws-load-balancer-controller copied to clipboard
[Feature] ability to configure target group names
#870 and #1899 added the ability to configure the load balancer names with the alb.ingress.kubernetes.io/load-balancer-name
annotation.
It would nice to also be able to configure the name of target groups. It could use the same annotation or a dedicated one.
@guillaumecle, how do you intend to configure the target group names? The target groups are based on the backend service, and it can be shared across multiple ingresses. The target group name format is k8s-
What is your use case for a custom target group name?
Our target names currently look like k8s-namespac-mysupers-2eb7cacf16
.
In many cases, 8 is not enough character to properly identify the service.
I would do something like this my-super-service-doing-great-things
I was thinking of using an annotation on the ingress. In case there are multiple ingresses using the same target group, it would reject the custom name (fallback on the default) or error out or pick one of the provided names (similar to the handling of load-balancer-name
in case of shared load balancer)
For the unique id, could it be possible to store it in a aws tag? how does it works for load balancer name?
My primary goal is to get more human readable/searchable target group name in cloud watch metrics, alb access logs and even just when browsing the list of target groups.
@guillaumecle, we use tags to identify target groups/load balancer resources, so the name doesn't matter to the controller. However, controller needs to ensure the name is unique. We can support annotation to specify a target name prefix via annotation on the service/ingress, and use the prefix+hash to make the target group name unique. Would this proposal satisfy your requirement?
/kind feature
I think that would work for us. Thanks.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale
- Mark this issue or PR as rotten with
/lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
+1. It would be nice to have this feature which will make the identification of ALB destinations much easier. Any ETA on when this can be made available? Atleast support to tag the target groups with custom labels?
I also agree that naming the target groups could be a useful feature, for example when monitoring the traffic handled by the target we may want to be able to clearly bind it to the service name, not guessing it from the X first letter.
same here, we have both 80 and 443 listening and would like to see at first glance what targetgroup handles what traffic. as often times, the same service exposes multiple ports, we actually would not only need a custom prefix, but on top an option to include the service-port in the targetgroup's name
so there could be 2 annotations:
alb.ingress.kubernetes.io/targetgroup-name-prefix
and alb.ingress.kubernetes.io/include-serviceport-in-targetgroup-name
this would translate to
- only prefix-annotation set: {custom_prefix}-{hash} (as outlined in earlier comments on this issue)
- only serviceport-annotation set: k8s-{tags}-{port}-{hash} (the default as it is now, just enhanced by the serviceport)
- both annotations set: {custom_prefix}-{port}-{hash}
is something in this direction possible?
+1
+1
+1
+1
+1
+1
+1
+1
This would help in cases were a single ALB has multiple target groups behind it.
Currently if you create an ingress object named "microservice-abc" on a namespace also named "microservice-abc" the generated target group is k8s-microser-microser-{10_random_chars}
which is not quite helpful.
Of course there's the ingress.k8s.aws/resource
tag which clears things up but filtering by tag is not always possible, e.g creating a Keda ScaledObject based on the TargetGroup CW Dimension.
+1
+1
+1 pleaseeeee
+1
+1 I use promethus-cloudwatch-exporter and I want to setup grafana dashboards. Having custom target group names will be of great help.
+1
+1
+1
had a crack at it if anyone wants to take a look at my PR ^
+1
+1
+1