4 Enabling LoadBalancer with MetalLB

Oracle Communications Cloud Native Environment (OCCNE) have MetalLB installed, and free external IPs are already configured under MetalLB. This section is applicable only for CNC Policy and cnPCRF.

Perform the following steps to enable LoadBalancer to specific services.

Note:

MetalLB configuration is supported only from OCCNE 1.4.

Note:

In the CNC Policy and cnPCRF namespaces, only diam-gateway service and cm service with GUI page requires loadbalancer setting with accessible external IP.

Updating diam-gateway Service

To update diam-gateway service:

  1. Login to Kubernetes cluster master node using ssh command.
  2. Run the following command to edit svc yaml file for diam-gateway:

    kubectl edit svc diam-gateway-service -n PCRF_NAME_SPACE

    Table 4-1 Variables

    Variable Name Description
    diam-gateway-service The name of diam-gateway service in setup.
    PCRF_NAME_SPACE The --namespace value used in helm install command.

    Following is an sample content that displays in diam-gateway edit window.

    1 # Please edit the object below. Lines beginning with a '#' will be ignored,
     2 # and an empty file will abort the edit. If an error occurs while saving this file will be
     3 # reopened with the relevant failures.
     4 #
     5 apiVersion: v1
     6 kind: Service
     7 metadata:
     8   creationTimestamp: 2019-06-02T13:06:11Z
     9   labels:
    10     category: common
    11     io.kompose.service: <PCRF_NAME>-pcrf-diam-gateway-service
    12   name: <PCRF_NAME>-pcrf-diam-gateway-service
    13   namespace: <PCRF_NAME_SPACE>
    14   resourceVersion: "21624671"
    15   selfLink: /api/v1/namespaces/<PCRF_NAME_SPACE>/services/<PCRF_NAME>-pcrf-diam-gateway-service
    16   uid: 31a4b13f-8537-11e9-81c8-0010e08b3a8e
    17 spec:
    18   clusterIP: 10.20.37.37
    19   externalTrafficPolicy: Cluster
    20   ports:
    21   - name: diameter
    22     nodePort: 32592
    23     port: 3868
    24     protocol: TCP
    25     targetPort: 3868
    26   - name: http
    27     nodePort: 31301
    28     port: 8080
    29     protocol: TCP
    30     targetPort: 8080
    31   selector:
    32     io.kompose.service: <PCRF_NAME>-pcrf-diam-gateway-service
    33   sessionAffinity: None
    34   type: NodePort
    35 status:
    36   loadBalancer: {}
  3. Add two new lines after line 7, after "metadata":

    annotations:

    metallb.universe.tf/address-pool: ADDRESS_POOL_NAME

    Note:

    • As per user MetalLB setting, you should select an appropriate pool name to replace the variable, ADDRESS_POOL_NAME
    • annotation: line must be kept vertical align with line 16, while following line, metallb.universe.tf/address-pool: ADDRESS_POOL_NAME must be kept vertical align with line 10. If vertical align restriction failed to follow this rule, the svc yaml file update may fail.
  4. Replace line 34 text, type: NodePort with type: LoadBalancer.

    Following is the sample content after replacing the line 29:

    1 # Please edit the object below. Lines beginning with a '#' will be ignored,
     2 # and an empty file will abort the edit. If an error occurs while saving this file will be
     3 # reopened with the relevant failures.
     4 #
     5 apiVersion: v1
     6 kind: Service
     7 metadata:
     8   creationTimestamp: 2019-06-02T13:06:11Z
     9   labels:
    10     category: common
    11     io.kompose.service: <PCRF_NAME>-pcrf-diam-gateway-service
    12   name: <PCRF_NAME>-pcrf-diam-gateway-service
    13   namespace: <PCRF_NAME_SPACE>
    14   resourceVersion: "21624671"
    15   selfLink: /api/v1/namespaces/<PCRF_NAME_SPACE>/services/<PCRF_NAME>-pcrf-diam-gateway-service
    16   uid: 31a4b13f-8537-11e9-81c8-0010e08b3a8e
    17 spec:
    18   clusterIP: 10.20.37.37
    19   externalTrafficPolicy: Cluster
    20   ports:
    21   - name: diameter
    22     nodePort: 32592
    23     port: 3868
    24     protocol: TCP
    25     targetPort: 3868
    26   - name: http
    27     nodePort: 31301
    28     port: 8080
    29     protocol: TCP
    30     targetPort: 8080
    31   selector:
    32     io.kompose.service: <PCRF_NAME>-pcrf-diam-gateway-service
    33   sessionAffinity: None
    34   type: LoadBalancer
    35 status:
    36   loadBalancer: {}
    
    
  5. Quit vim editor and save changes. A new diam-gateway pod starts up.
    1. In the new service, following sample content displays. Note that if the EXTERNAL-IP is available, then the load balancer setting for diam-gateway service works.
      NAME                      TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)                                                    AGE
      <PCRF_NAME>-diam-gateway-service       LoadBalancer   10.xxx.xx.xx    10.xxx.xxx.xx   3868:32592/TCP,8080:31301/TCP 4d   

Updating cm-service

Follow the same process to update svc yaml for PCRF_NAME -pcrf-cm-service.