Change keepalived VRID

What is the keepalived VRID?

ARTESCA uses keepalived to manage the Virtual IP addresses of the cluster.

For each Virtual IP address, there is one instance of keepalived using a different Virtual Router ID (VRID) to identify itself.

Why may I need to change the VRID?

The VRID is a number between 0 and 255. It is a very narrow range, so it is possible that other services in the same network use the same VRID.

If a conflict is detected, one way to solve it is to change the VRID of one or more keepalived instances in the ARTESCA cluster.

How to change the VRIDs?

  1. Connect to the bootstrap node of the cluster where you want to change the VRID.

  2. List the ConfigMaps that contain the configuration of the keepalived instances.

    [artesca-os@bootstrap ~]$
    
    sudo kubectl --kubeconfig /etc/kubernetes/admin.conf \
    get cm -n metalk8s-vips | \
    grep -v crt
    
    NAME               DATA   AGE
    default            1      210d
    
  3. For each ConfigMap in the list:

    1. Edit the ConfigMap.

      Note

      Replace <CONFIGMAP_NAME> with the name of the ConfigMap.

      [artesca-os@bootstrap ~]$
      
      sudo kubectl --kubeconfig /etc/kubernetes/admin.conf \
      edit cm -n metalk8s-vips <CONFIGMAP_NAME>
      
    2. In the editor, change the VRID of the keepalived instance.

      Important

      You must only change the vr_id fields. Do not change any other fields.

      apiVersion: v1
        data:
          hl-config.yaml: |
            apiVersion: metalk8s.scality.com/v1alpha1
            kind: KeepalivedConfiguration
            addresses:
            - ip: 10.50.0.1
              node: bootstrap
              vr_id: 51 <--------------------- Change the VRID here
            - ip: 10.50.0.2
              node: node1
              vr_id: 52 <--------------------- Change the VRID here
            - ip: 10.50.0.3
              node: node2
              vr_id: 53 <--------------------- Change the VRID here
            healthcheck: https://127.0.0.1:443/healthz
        kind: ConfigMap
        metadata:
          creationTimestamp: "2024-05-29T14:57:40Z"
          labels:
            app.kubernetes.io/component: metalk8s-vips
            app.kubernetes.io/instance: default
            app.kubernetes.io/managed-by: metalk8s-operator
            app.kubernetes.io/name: virtualippool
            app.kubernetes.io/part-of: metalk8s
            app.kubernetes.io/version: 126.0.2
            metalk8s.scality.com/version: 126.0.2
          name: default
          namespace: metalk8s-vips
          ownerReferences:
          - apiVersion: metalk8s.scality.com/v1alpha1
            blockOwnerDeletion: true
            controller: true
            kind: VirtualIPPool
            name: default
            uid: d1560905-ed7c-416c-a36b-5752867c8fc9
          resourceVersion: "120248"
          uid: 1cc25f56-5339-44c2-8ab2-74309626cdd4
      
    3. Save and close the editor.

    4. Check the keepalived pods to see if they have been restarted:

      Note

      Replace <CONFIGMAP_NAME> with the name of the ConfigMap.

      [artesca-os@bootstrap ~]$
      
      sudo kubectl --kubeconfig /etc/kubernetes/admin.conf \
      get pods -n metalk8s-vips | \
      grep <CONFIGMAP_NAME>
      
      default-29kxr   1/1     Running   0          2s
      default-pqtbb   1/1     Running   0          5s
      default-vb2rm   1/1     Running   0          9s