API
The Gcore Customer Portal is being updated. Screenshots may not show the current version.
Edge Cloud
Edge Cloud
OverviewBillingTerraformAnsible
API
Chosen image
Home/Edge Cloud/Networking/Load Balancers/Annotations

Use annotations for Load Balancers

Annotations are a way to add custom, non-identifiable metadata to objects. They are used to configure additional behavior for Load Balancers service in Kubernetes clusters beyond the standard configuration offerings. Learn more about annotations in the official Kubernetes documentation.

You can add annotations via the command line (kubectl) or the Kubernetes service manifest using the annotations field as follows:

metadata: {
 annotations: {
   key: "value"
 }
}

Below, we have compiled annotations that apply to clusters created in Gcore:

Key (annotation) Value sample Type Description
loadbalancer.gcorelabs.com/
ddos-profile
{ "profile_template":65,
"fields": [{ "base_field":272,
"field_value":40 }] }
Integer Configures and ads the DDoS Protection profile to the Load Balancer
loadbalancer.gcorelabs.com/
flavor
lb1-1-2 String Specifies a custom name for the flavor
loadbalancer.gcorelabs.com/
floating-cleanup
true Boolean Automatically cleans up the floating IP assigned to the Load Balancer after deleting the service
loadbalancer.gcorelabs.com/
logging-topic-name
topic-123 String Specifies LaaS topic name for pushing logs.
Note: Must be used with the logging-destination-region-id, otherwise logs won’t be sent to LaaS
loadbalancer.gcorelabs.com/
logging-destination-region-id
1 Integer Specifies LaaS destination region.
Note: Must be used with the logging-topic-name, otherwise logs won’t be sent to LaaS
loadbalancer.gcorelabs.com/
logging-retention-policy-period
45 Integer Configures log retention policy for LaaS topic (in days)
loadbalancer.gcorelabs.com/
proxy-protocol
true Boolean Enables proxy protocol type for Load Balancer listeners
loadbalancer.gcorelabs.com/
timeout-client-data
6000 Integer Sets client data timeouts for Load Balancer listeners (in msec).
Note: When removed, the previously set value in effect
loadbalancer.gcorelabs.com/
timeout-member-connect
6000 Integer Sets member connect timeouts for Load Balancer listeners (in msec).
Note: When removed, the previously set value in effect
loadbalancer.gcorelabs.com/
timeout-member-data
6000 Integer Sets member data timeouts for Load Balancer listeners (in msec).
Note: When removed, the previously set value in effect
loadbalancer.gcorelabs.com/
x-forwarded-for
true Boolean Adds the “X-Forwarded-For,” “X-Forwarded-Port” and “X-Forwarded-Proto“ headers to requests
service.beta.kubernetes.io/
gcore-internal-load-balancer
true Boolean Disables floating IP creation and makes the Load Balancer non available for external requests
service.beta.kubernetes.io/
gcore-external-load-balancer
true Boolean Makes the Load Balancer public

Examples

Here, several examples of annotations using are presented.

To assign an Advanced DDoS protection profile to your cluster, use the following code in the manifest:

apiVersion: v1
kind: Service
metadata:
  annotations:
    loadbalancer.gcorelabs.com/ddos-profile: |
  {"profile_template":65,"fields":[{"base_field":272,"field_value":40}]}
  labels:
    app: grafana
  name: grafana
  namespace: default
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: grafana
  type: LoadBalancer

Instead of the sample values (65, 272, and 40), use the appropriate values for your project. The value format is the same as supported by the public DDoS Protection API.

To enable logging for your cluster, use the following one:

apiVersion: v1
kind: Service
metadata:
  annotations:
    loadbalancer.gcorelabs.com/logging-topic-name: test123
    loadbalancer.gcorelabs.com/logging-destination-region-id: 15
  labels:
    app: grafana
  name: grafana
  namespace: default
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: grafana
  type: LoadBalancer

Instead of the sample values (test123 and 15), use the appropriate values for your project.

Was this article helpful?

Not a Gcore user yet?

Discover our offerings, including virtual instances starting from 3.7 euro/mo, bare metal servers, AI Infrastructure, load balancers, Managed Kubernetes, Function as a Service, and Centralized Logging solutions.

Go to the product page