---
title: Using Scaleway Load Balancer annotations
description: This page explains how to use Scaleway Load Balancer annotations
tags: kubernetes load-balancer load-balancer-annotations annotations
dates:
  validation: 2025-09-17
  posted: 2021-08-12
---

## Overview

In Kubernetes, annotations are a way to attach metadata to objects, like Pods, services, and more. These annotations are key-value pairs that can be useful for tools and libraries interacting with these objects. These annotations are used to influence the behavior, settings, or configurations of the provisioned load balancer resource.

When you [create a Load Balancer](/kubernetes/reference-content/kubernetes-load-balancer/) for your Kubernetes cluster, it will be created with a default configuration, unless you define its configuration parameters via **annotations**. Load Balancer annotations let you configure parameters such as the balancing method health check settings and more.

See the full list of available Load Balancer annotations [here](https://github.com/scaleway/scaleway-cloud-controller-manager/blob/master/docs/loadbalancer-annotations.md) as part of the Scaleway Cloud Controller Manager documentation. For help understanding any of these parameters, refer to the following documentation:
- [Load Balancer Concepts](/load-balancer/concepts/)
- [Configuring backends](/load-balancer/reference-content/configuring-backends/)
- [Configuring frontends](/load-balancer/reference-content/configuring-frontends/)
- [Configuring health checks](/load-balancer/reference-content/configuring-health-checks/)

<Message type="important">
You should **always** use annotations as described below to configure your cluster's Load Balancer. Any modifications made to the configuration of your Kubernetes cluster's Load Balancer via the Scaleway console, the API, or any other developer tools, will be **overwritten by the cluster's CCM**.
</Message>

The following documentation shows you how to use annotations to fine tune your Load Balancer's configuration.

<Message type="tip">
  For a complete list of all annotations available to use with Scaleway Load Balancers, refer directly to the [Scaleway Cloud Controller Manager documentation](https://github.com/scaleway/scaleway-cloud-controller-manager/blob/master/docs/loadbalancer-annotations.md) on GitHub.
</Message>

## Adding annotations when creating your Load Balancer

Add annotations to the `metadata` section of your LoadBalancer Service's yaml manifest as shown below. In this example we include two annotations, but you can include as many as you need.

    ```yaml
    apiVersion: v1
    kind: Service
    metadata:
      name: myloadbalancer
      annotations:
        service.beta.kubernetes.io/scw-loadbalancer-forward-port-algorithm: "leastconn"
        service.beta.kubernetes.io/scw-loadbalancer-health-check-delay: "10s"
    spec:
      type: LoadBalancer
      ports:
      - port: 8000
        name: http
        targetPort: 8000
      selector:
        app: mydeployment
    ```

You can then create your Load Balancer with the `kubectl create -f <name-of-manifest-file>.yaml` command.

When you examine your Load Balancer's backend configuration and health check information in the Scaleway console, you will see that the balancing method (aka forward port algorithm) and health check interval (aka health check delay) of its backend reflect the values set in the annotations.

## Modifying your Load Balancer's configuration via annotations after creation

To modify your Load Balancer's configuration with annotations after creation, you can use the `kubectl patch` command. This updates the Load Balancer according to the arguments given.

In this example, we create the following file to hold our patch, and call it `annotations-patch.yaml`:

```yaml
metadata:
  annotations:
    service.beta.kubernetes.io/scw-loadbalancer-forward-port-algorithm: "first"
    service.beta.kubernetes.io/scw-loadbalancer-health-check-timeout: "30s"
```

You can then make the CCM execute this patch with the following command:

```
kubectl patch svc myloadbalancer --type merge --patch-file annotations-patch.yaml
```

When you examine your Load Balancer's backend configuration and health check information in the Scaleway console, you will see that the balancing method (aka forward port algorithm) and health check timeout of its backend reflect the values set in the patched annotations.
