Skip to content


Service annotations

  • Annotation keys and values can only be strings. All other types below must be string-encoded, for example:
    • boolean: "true"
    • integer: "42"
    • stringList: "s1,s2,s3"
    • stringMap: "k1=v1,k2=v2"
    • json: "{ \"key\": \"value\" }"



These annotations are specific to the kubernetes service resources reconciled by the AWS Load Balancer Controller. Although the list was initially derived from the k8s in-tree kube-controller-manager, this documentation is not an accurate reference for the services reconciled by the in-tree controller.

Name Type Default Notes stringList string string default instance in case of LoadBalancerClass string boolean false deprecated, in favor of aws-load-balancer-scheme string internal string Set to "*" to enable string ipv4 ipv4 | dualstack boolean false deprecated, in favor of aws-load-balancer-attributes string deprecated, in favor of aws-load-balancer-attributes string deprecated, in favor of aws-load-balancer-attributes boolean false deprecated, in favor of aws-load-balancer-attributes stringList stringList string ELBSecurityPolicy-2016-08 string stringMap string TCP integer | traffic-port traffic-port string "/" for HTTP(S) protocols integer 3 integer 3 integer 10 integer 10 string 200-399 stringList internet-facing lb only. Length must match the number of subnets stringList internal lb only. Length must match the number of subnets stringList dualstack lb only. Length must match the number of subnets stringMap stringList string stringMap stringMap stringList boolean true

Traffic Routing

Traffic Routing can be controlled with following annotations:

  • specifies the custom name to use for the load balancer. Name longer than 32 characters will be treated as an error.


    • If you modify this annotation after service creation, there is no effect.

    Example custom-name
  • specifies the load balancer type. This controller reconciles those service resources with this annotation set to either nlb-ip or external.


    This annotation specifies the controller used to provision LoadBalancers (as specified in legacy-cloud-provider). Refer to lb-scheme to specify whether the LoadBalancer is internet-facing or internal.

    • [Deprecated] For type nlb-ip, the controller will provision an NLB with targets registered by IP address. This value is supported for backwards compatibility.
    • For type external, the NLB target type depends on the nlb-target-type annotation.


    • This annotation should not be modified after service creation.

    Example external
  • specifies the target type to configure for NLB. You can choose between instance and ip.

    • instance mode will route traffic to all EC2 instances within cluster on the NodePort opened for your service. The kube-proxy on the individual worker nodes sets up the forwarding of the traffic from the NodePort to the pods behind the service.

      • service must be of type NodePort or LoadBalancer for instance targets
      • for k8s 1.22 and later if spec.allocateLoadBalancerNodePorts is set to false, NodePort must be allocated manually

      default value

      If you configure spec.loadBalancerClass, the controller defaults to instance target type

      NodePort allocation

      k8s version 1.22 and later support disabling NodePort allocation by setting the service field spec.allocateLoadBalancerNodePorts to false. If the NodePort is not allocated for a service port, the controller will fail to reconcile instance mode NLB.

    • ip mode will route traffic directly to the pod IP. In this mode, AWS NLB sends traffic directly to the Kubernetes pods behind the service, eliminating the need for an extra network hop through the worker nodes in the Kubernetes cluster.

      • ip target mode supports pods running on AWS EC2 instances and AWS Fargate
      • network plugin must use native AWS VPC networking configuration for pod IP, for example Amazon VPC CNI plugin.

    Example instance
  • specifies the Availability Zone the NLB will route traffic to. See Network Load Balancers for more details.


    Subnets are auto-discovered if this annotation is not specified, see Subnet Discovery for further details.

    You must specify at least one subnet in any of the AZs, both subnetID or subnetName(Name tag on subnets) can be used.


    • Each subnets must be from a different Availability Zone
    • AWS has restrictions on disabling existing subnets for NLB. As a result, you might not be able to edit this annotation once the NLB gets provisioned.

    Example subnet-xxxx, mySubnet
  • allows you to configure the ALPN policies on the load balancer.

    supported policies

    • HTTP1Only Negotiate only HTTP/1.*. The ALPN preference list is http/1.1, http/1.0.
    • HTTP2Only Negotiate only HTTP/2. The ALPN preference list is h2.
    • HTTP2Optional Prefer HTTP/1.* over HTTP/2 (which can be useful for HTTP/2 testing). The ALPN preference list is http/1.1, http/1.0, h2.
    • HTTP2Preferred Prefer HTTP/2 over HTTP/1.*. The ALPN preference list is h2, http/1.1, http/1.0.
    • None Do not negotiate ALPN. This is the default.

    Example HTTP2Preferred
  • specifies which nodes to include in the target group registration for instance target type.

    Example label1=value1, label2=value2
  • specifies a list of elastic IP address configuration for an internet-facing NLB.


    • This configuration is optional, and you can use it to assign static IP addresses to your NLB
    • You must specify the same number of eip allocations as load balancer subnets annotation
    • NLB must be internet-facing

    Example eipalloc-xyz, eipalloc-zzz
  • specifies a list of private IPv4 addresses for an internal NLB.


    • NLB must be internal
    • This configuration is optional, and you can use it to assign static IPv4 addresses to your NLB
    • You must specify the same number of private IPv4 addresses as load balancer subnets annotation
    • You must specify the IPv4 addresses from the load balancer subnet IPv4 ranges

  • specifies a list of IPv6 addresses for an dualstack NLB.


    • NLB must be dualstack
    • This configuration is optional, and you can use it to assign static IPv6 addresses to your NLB
    • You must specify the same number of private IPv6 addresses as load balancer subnets annotation
    • You must specify the IPv6 addresses from the load balancer subnet IPv6 ranges

    Example 2600:1f13:837:8501::1, 2600:1f13:837:8504::1

Traffic Listening

Traffic Listening can be controlled with following annotations:

Resource attributes

NLB resource attributes can be controlled via the following annotations:

  • specifies whether to enable proxy protocol v2 on the target group. Set to '*' to enable proxy protocol v2. This annotation takes precedence over the annotation for proxy protocol v2 configuration.

    The only valid value for this annotation is *.

  • specifies the Target Group Attributes to be configured.


    • set the deregistration delay to 120 seconds (available range is 0-3600 seconds) deregistration_delay.timeout_seconds=120
    • enable source IP affinity stickiness.enabled=true,stickiness.type=source_ip
    • enable proxy protocol version 2 proxy_protocol_v2.enabled=true
    • enable connection termination on deregistration deregistration_delay.connection_termination.enabled=true
    • enable client IP preservation preserve_client_ip.enabled=true
    • disable immediate connection termination for unhealthy targets and configure a 30s draining interval (available range is 0-360000 seconds) target_health_state.unhealthy.connection_termination.enabled=false,target_health_state.unhealthy.draining_interval_seconds=30
  • specifies Load Balancer Attributes that should be applied to the NLB.

    Only attributes defined in the annotation will be updated. To unset any AWS defaults(e.g. Disabling access logs after having them enabled once), the values need to be explicitly set to the original values(access_logs.s3.enabled=false) and omitting them is not sufficient. Custom attributes set in this annotation's config map will be overriden by annotation-specific attributes. For backwards compatibility, existing annotations for the individual load balancer attributes get precedence in case of ties.

    • If deletion_protection.enabled=true is in the annotation, the controller will not be able to delete the NLB during reconciliation. Once the attribute gets edited to deletion_protection.enabled=false during reconciliation, the deployer will force delete the resource.
    • Please note, if the deletion protection is not enabled via annotation (e.g. via AWS console), the controller still deletes the underlying resource.


    • enable access log to s3 access_logs.s3.enabled=true,access_logs.s3.bucket=my-access-log-bucket,access_logs.s3.prefix=my-app
    • enable NLB deletion protection deletion_protection.enabled=true
    • enable cross zone load balancing load_balancing.cross_zone.enabled=true
    • enable client availability zone affinity dns_record.client_routing_policy=availability_zone_affinity
  • the following annotations are deprecated in v2.3.0 release in favor of 

AWS Resource Tags

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

  • ${clusterName}
  • ${stackID}
  • ${resourceID}

In addition, you can use annotations to specify additional tags

  • specifies additional tags to apply to the AWS resources.

    • you cannot override the default controller tags mentioned above or the tags specified in the --default-tags controller flag
    • if any of the tag conflicts with the ones configured via --external-managed-tags controller flag, the controller fails to reconcile the service

    Example Environment=dev,Team=test

Health Check

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


You can configure TLS support via the following annotations:

  • specifies the ARN of one or more certificates managed by the AWS Certificate Manager.

    The first certificate in the list is the default certificate and remaining certificates are for the optional certificate list. See Server Certificates for further details.

    Example arn:aws:acm:us-west-2:xxxxx:certificate/xxxxxxx
  • specifies the frontend ports with TLS listeners.

    • You must configure at least one certificate for TLS listeners
    • You can specify a list of port names or port values, * does not match any ports
    • If you don't specify this annotation, controller creates TLS listener for all the service ports
    • Specify this annotation if you need both TLS and non-TLS listeners on the same load balancer

    Example 443, custom-port
  • specifies the Security Policy for NLB frontend connections, allowing you to control the protocol and ciphers.

    Example ELBSecurityPolicy-TLS13-1-2-2021-06
  • specifies whether to use TLS for the backend traffic between the load balancer and the kubernetes pods.

    • If you specify ssl as the backend protocol, NLB uses TLS connections for the traffic to your kubernetes pods in case of TLS listeners
    • You can specify ssl or tcp (default)

    Example ssl

Access control

Load balancer access can be controlled via following annotations:

  • specifies the CIDRs that are allowed to access the NLB.


    we recommend specifying CIDRs in the service spec.loadBalancerSourceRanges instead


    • will be used if the IPAddressType is "ipv4"
    • and ::/0 will be used if the IPAddressType is "dualstack"
    • The VPC CIDR will be used if is internal

    This annotation will be ignored in case preserve client IP is not enabled. - preserve client IP is disabled by default for IP targets - preserve client IP is enabled by default for instance targets

    Preserve client IP has no effect on traffic converted from IPv4 to IPv6 and on traffic converted from IPv6 to IPv4. The source IP of this type of traffic is always the private IP address of the Network Load Balancer. - This could cause the clients that have their traffic converted to bypass the specified CIDRs that are allowed to access the NLB.

    this annotation will be ignored if is specified.

  • specifies whether the NLB will be internet-facing or internal. Valid values are internal, internet-facing. If not specified, default is internal.

    Example "internet-facing"
  • specifies whether the NLB will be internet-facing or internal.

    deprecation note

    This annotation is deprecated starting v2.2.0 release in favor of the new aws-load-balancer-scheme annotation. It will be supported, but in case of ties, the aws-load-balancer-scheme gets precedence.

    Example "true"

    When this annotation is not present, the controller will automatically create one security group. The security group will be attached to the LoadBalancer and allow access from inbound-cidrs to the listen-ports. Also, the securityGroups for target instances/ENIs will be modified to allow inbound traffic from this securityGroup.

    If you specify this annotation, you need to configure the security groups on your target instances/ENIs to allow inbound traffic from the load balancer. You could also set the manage-backend-security-group-rules if you want the controller to manage the security group rules.

    Both name and ID of securityGroups are supported. Name matches a Name tag, not the groupName attribute.

    Example sg-xxxx, nameOfSg1, nameOfSg2
  • specifies whether the controller should automatically add the ingress rules to the instance/ENI security group.

    If you disable the automatic management of security group rules for an NLB, you will need to manually add appropriate ingress rules to your EC2 instance or ENI security groups to allow access to the traffic and health check ports.

    Example "false"

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 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+.