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.4.1 Updating diam-gateway Service
To update diam-gateway service:
- Login to Kubernetes cluster master node using ssh command.
-
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: {}
-
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.
- Quit vim editor and save changes.
Updating cm-service
Follow the same process to update svc yaml for PCRF_NAME -pcrf-cm-service.
4.2 Updating Ingress Gateway Service
To update Ingress gateway service:
- Login to Kubernetes cluster master node using ssh command.
-
Run the following command to edit svc yaml file for ingress gateway:
kubectl edit svc ingress-gateway-service -n PCF_NAME_SPACE
Table 4-2 Variables
Variable Name Description ingress-gateway-service The name of ingress-gateway service in setup. PCF_NAME_SPACE The --namespace value used in Helm install command. -
The following MetalLB configuaration lines need to be added in the annotation: of metadata:
annotations:
metallb.universe.tf/address-pool: ADDRESS_POOL_NAME
metallb.universe.tf/allow-shared-ip: sharedip
Note:
As per user MetalLB setting, you should select an appropriate pool name to replace the variable, ADDRESS_POOL_NAMENote:
The parameter global.metalLbIpAllocationEnabled must be enabled for metallb IP allocation. - Quit vim editor and save changes.