Skip to content

Annotations

Service annotations

Annotations

NameTypeDefaultNotes
service.beta.kubernetes.io/load-balancer-source-rangesstringList
service.beta.kubernetes.io/aws-load-balancer-security-group-prefix-listsstringList
service.beta.kubernetes.io/aws-load-balancer-typestring
service.beta.kubernetes.io/aws-load-balancer-nlb-target-typestringdefault instance in case of LoadBalancerClass
service.beta.kubernetes.io/aws-load-balancer-namestring
service.beta.kubernetes.io/aws-load-balancer-internalbooleanfalsedeprecated, in favor of aws-load-balancer-scheme
service.beta.kubernetes.io/aws-load-balancer-schemestringinternal
service.beta.kubernetes.io/aws-load-balancer-proxy-protocolstringSet to "*" to enable
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol-per-target-groupstringIf specified,configures proxy protocol for the target groups corresponding to the ports mentioned and disables for the rest. For example, if you have services deployed on ports "80, 443 and 22", the annotation value "80, 443" will enable proxy protocol for ports 80 and 443 only, and disable for port 22. This annotation is overriden by "service.beta.kubernetes.io/aws-load-balancer-proxy-protocol"
service.beta.kubernetes.io/aws-load-balancer-ip-address-typestringipv4ipv4 | dualstack
service.beta.kubernetes.io/aws-load-balancer-access-log-enabledbooleanfalsedeprecated, in favor of aws-load-balancer-attributes
service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-namestringdeprecated, in favor of aws-load-balancer-attributes
service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefixstringdeprecated, in favor of aws-load-balancer-attributes
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabledbooleanfalsedeprecated, in favor of aws-load-balancer-attributes
service.beta.kubernetes.io/aws-load-balancer-ssl-certstringList
service.beta.kubernetes.io/aws-load-balancer-ssl-portsstringList
service.beta.kubernetes.io/aws-load-balancer-ssl-negotiation-policystringELBSecurityPolicy-2016-08
service.beta.kubernetes.io/aws-load-balancer-backend-protocolstring
service.beta.kubernetes.io/aws-load-balancer-additional-resource-tagsstringMap
service.beta.kubernetes.io/aws-load-balancer-healthcheck-protocolstringTCP
service.beta.kubernetes.io/aws-load-balancer-healthcheck-portinteger | traffic-porttraffic-port
service.beta.kubernetes.io/aws-load-balancer-healthcheck-pathstring"/" for HTTP(S) protocols
service.beta.kubernetes.io/aws-load-balancer-healthcheck-healthy-thresholdinteger3
service.beta.kubernetes.io/aws-load-balancer-healthcheck-unhealthy-thresholdinteger3
service.beta.kubernetes.io/aws-load-balancer-healthcheck-timeoutinteger10
service.beta.kubernetes.io/aws-load-balancer-healthcheck-intervalinteger10
service.beta.kubernetes.io/aws-load-balancer-healthcheck-success-codesstring200-399
service.beta.kubernetes.io/aws-load-balancer-eip-allocationsstringListinternet-facing lb only. Length must match the number of subnets
service.beta.kubernetes.io/aws-load-balancer-private-ipv4-addressesstringListinternal lb only. Length must match the number of subnets
service.beta.kubernetes.io/aws-load-balancer-ipv6-addressesstringListdualstack lb only. Length must match the number of subnets
service.beta.kubernetes.io/aws-load-balancer-target-group-attributesstringMap
service.beta.kubernetes.io/aws-load-balancer-subnetsstringList
service.beta.kubernetes.io/aws-load-balancer-alpn-policystring
service.beta.kubernetes.io/aws-load-balancer-target-node-labelsstringMap
service.beta.kubernetes.io/aws-load-balancer-attributesstringMap
service.beta.kubernetes.io/aws-load-balancer-security-groupsstringList
service.beta.kubernetes.io/aws-load-balancer-manage-backend-security-group-rulesbooleantrueIf service.beta.kubernetes.io/aws-load-balancer-security-groups is specified, this must also be explicitly specified otherwise it defaults to false.
service.beta.kubernetes.io/aws-load-balancer-inbound-sg-rules-on-private-link-trafficstring
service.beta.kubernetes.io/aws-load-balancer-listener-attributes.${Protocol}-${Port}stringMap
service.beta.kubernetes.io/aws-load-balancer-multi-cluster-target-groupbooleanfalseIf specified, the controller will only operate on targets that exist within the cluster, ignoring targets from other sources.
service.beta.kubernetes.io/aws-load-balancer-enable-prefix-for-ipv6-source-natstringoffOptional annotation. dualstack lb only. Allowed values - on and off
service.beta.kubernetes.io/aws-load-balancer-source-nat-ipv6-prefixesstringListOptional annotation. dualstack lb only. This annotation is only applicable when user has to set the service.beta.kubernetes.io/aws-load-balancer-enable-prefix-for-ipv6-source-nat to "on". Length must match the number of subnets
service.beta.kubernetes.io/aws-load-balancer-minimum-load-balancer-capacitystringMap
service.beta.kubernetes.io/aws-load-balancer-enable-icmp-for-path-mtu-discoverystringIf specified, a security group rule is added to the managed security group to allow explicit ICMP traffic for Path MTU discovery for IPv4 and dual-stack VPCs. Creates a rule for each source range if service.beta.kubernetes.io/load-balancer-source-ranges is present.
service.beta.kubernetes.io/aws-load-balancer-enable-tcp-udp-listenerbooleanfalseIf specified, the controller will attempt to try TCP_UDP Listeners when the service defines a TCP and UDP port on the same port number.

Traffic Routing

Traffic Routing can be controlled with following annotations:

Traffic Listening

Traffic Listening can be controlled with following annotations:

Support UDP-based services over IPv6

You can configure dualstack NLB to support UDP-based services over IPv6 via the following annotations:

Resource attributes

NLB resource attributes can be controlled via the following annotations:

!!!note "" - To change the default from false to true, use the controller flag --feature-gates=EnableTCPUDPListener=true to allow creation of TCP_UDP listeners for all services. !!!example - Allow for the creation of TCP_UDP listeners for a service.

service.beta.kubernetes.io/aws-load-balancer-enable-tcp-udp-listener: "true"

  • the following annotations are deprecated in v2.3.0 release in favor of service.beta.kubernetes.io/aws-load-balancer-attributes

  • service.beta.kubernetes.io/aws-load-balancer-multi-cluster-target-group Allows you to share the created Target Group ARN with other Load Balancer Controller managed clusters.

    This feature does not offer any Deletion Protection. Deleting the service will still delete the Target Group. If you need to support Target Groups shared with multiple clusters, it's recommended to use an out-of-band Target Group that is not managed by a Load Balancer Controller.

    • It is not recommended to change this value frequently, if ever. The recommended way to set this value is on creation of the service.
    service.beta.kubernetes.io/aws-load-balancer-multi-cluster-target-group: "true"
    

AWS Resource Tags

The AWS Load Balancer Controller automatically applies following tags to the AWS resources it creates (NLB/TargetGroups/Listener/ListenerRule):

  • elbv2.k8s.aws/cluster: ${clusterName}
  • service.k8s.aws/stack: ${stackID}
  • service.k8s.aws/resource: ${resourceID}

In addition, you can use annotations to specify additional tags

Health Check

Health check on target groups can be configured with following annotations:

TLS

You can configure TLS support via the following annotations:

Access control

Load balancer access can be controlled via following annotations:

Capacity Unit Reservation

Load balancer capacity unit reservation can be configured via following annotations:

Legacy Cloud Provider

The AWS Load Balancer Controller manages Kubernetes Services in a compatible way with the AWS cloud provider's legacy service controller.

  • For users on v2.5.0+, The AWS LBC provides a mutating webhook for service resources to set the spec.loadBalancerCLass field for Serive of type LoadBalancer, effectively making the AWS LBC the default controller for Service of type LoadBalancer. Users can disable this feature and revert to using the AWS Cloud Controller Manager as the default service controller by setting the helm chart value enableServiceMutatorWebhook to false with --set enableServiceMutatorWebhook=false .
  • For users on older versions, the annotation service.beta.kubernetes.io/aws-load-balancer-type is used to determine which controller reconciles the service. If the annotation value is nlb-ip or external, recent versions of the legacy cloud provider ignore the Service resource so that the AWS LBC can take over. For all other values of the annotation, the legacy cloud provider will handle the service. Note that this annotation should be specified during service creation and not edited later. Support for the annotation was added to the legacy cloud provider in Kubernetes v1.20, and is backported to v1.18.18+ and v1.19.10+.