View on GitHub Star

Gradiant Open5gs Operator

Deploy and manage Open5GS on Kubernetes with the Open5GS Operator

Advanced Deployment of Open5GS on Kubernetes

This tutorial provides an in-depth guide on configuring the Open5GS Custom Resource Definition (CRD) used by the Kubernetes operator to deploy and manage Open5GS. It covers configurable fields, default values, and customization options tailored to specific requirements. Additionally, it includes an example of modifying the manifest and analyzing its impact on the deployment. ServiceMonitors are is used in this tutorial so if the ServiceMonitor CRD is not installed in your cluster, you can ignore the references to them.


1. Complete Open5GS CRD Manifest

The following manifest defines a comprehensive instance of Open5GS, incorporating all components and default configurations:

apiVersion: net.gradiant.org/v1
kind: Open5GS
metadata:
  labels:
    app.kubernetes.io/name: open5gs-operator
    app.kubernetes.io/managed-by: kustomize
  name: open5gs-sample
spec:
  open5gsImage: "docker.io/gradiant/open5gs:2.7.4"
  webuiImage: "docker.io/gradiant/open5gs-webui:2.7.4"
  mongoDBVersion: "5.0.10-debian-11-r3"
  amf:
    enabled: true
    serviceAccount: true
    metrics: true
    serviceMonitor: true
    service:
      - name: ngap
        serviceType: ClusterIP
  ausf:
    enabled: true
    serviceAccount: true
  bsf:
    enabled: true
    serviceAccount: true
  mongoDB:
    enabled: true
    serviceAccount: true
  nrf:
    enabled: true
    serviceAccount: true
  nssf:
    enabled: true
    serviceAccount: true
  pcf:
    enabled: true
    metrics: true
    serviceMonitor: true
    serviceAccount: true
  smf:
    enabled: true
    metrics: true
    serviceMonitor: true
    serviceAccount: true
    service:
      - name: pfcp
        serviceType: ClusterIP
  upf:
    enabled: true
    metrics: true
    serviceMonitor: true
    serviceAccount: true
    service:
      - name: pfcp
        serviceType: ClusterIP
      - name: gtpu
        serviceType: ClusterIP
  webui:
    enabled: true
    serviceAccount: true
  configuration:
    mcc: "999"
    mnc: "70"
    tac: "0001"
    region: "2"
    set: "1"
    slices:
      - sst: "1"
        sd: "0x111111"
      - sst: "2"
        sd: "0x222222"

Download open5gs-advanced-deployment.yaml

Apply the manifest to the cluster:

kubectl apply -f open5gs-advanced-deployment.yaml

1.1 Explanation of Configurable Fields

2. Applying the Manifest with Modifications

We will modify some fields to observe their impact on the deployment:

apiVersion: net.gradiant.org/v1
kind: Open5GS
metadata:
  labels:
    app.kubernetes.io/name: open5gs-operator
    app.kubernetes.io/managed-by: kustomize
  name: open5gs-sample
spec:
  open5gsImage: "docker.io/gradiant/open5gs:2.7.4"
  webuiImage: "docker.io/gradiant/open5gs-webui:2.7.4"
  mongoDBVersion: "5.0.10-debian-11-r3"
  amf:
    enabled: true
    serviceAccount: true
    metrics: true
    serviceMonitor: false
    service:
      - name: ngap
        serviceType: ClusterIP
  ausf:
    enabled: true
    serviceAccount: false
  bsf:
    enabled: false
  mongoDB:
    enabled: true
    serviceAccount: true
  nrf:
    enabled: true
    serviceAccount: true
  nssf:
    enabled: true
    serviceAccount: true
  pcf:
    enabled: true
    metrics: true
    serviceMonitor: true
    serviceAccount: true
  smf:
    enabled: true
    metrics: false
    serviceMonitor: true
    serviceAccount: true
    service:
      - name: pfcp
        serviceType: LoadBalancer
  upf:
    enabled: true
    metrics: true
    serviceMonitor: true
    serviceAccount: true
    service:
      - name: pfcp
        serviceType: NodePort
      - name: gtpu
        serviceType: ClusterIP
  webui:
    enabled: true
    serviceAccount: true
  configuration:
    mcc: "999"
    mnc: "70"
    tac: "0001"
    slices:
      - sst: "1"
        sd: "0x111111"
      - sst: "2"
        sd: "0x222222"

Download open5gs-advanced-deployment-modified.yaml

Apply the manifest to the cluster:

kubectl apply -f open5gs-advanced-deployment-modified.yaml

2.1 Changes Made

As the slice configuration was not modified (only some values were omitted), the default slices will be used thus no changes will be observed in the deployment. If the slice configuration was modified, the changes would be reflected in the deployment by modifiying the NSSF and AMF ConfigMaps and restarting the pods in order to apply the changes.

3. Verifying Changes

To observe the effects of the changes in the cluster:


4. Managing Open5GS Users

4.1 Understanding User Fields

4.2 Adding a New User

Create a new Open5GSUser CRD with the following manifest:

apiVersion: net.gradiant.org/v1
kind: Open5GSUser
metadata:
  name: open5gsuser-sample
spec:
  imsi: "999700000000001"
  key: "465B5CE8B199B49FAA5F0A2EE238A6BC"
  opc: "E8ED289DEBA952E4283B54E88E6183CA"
  sd: "111111"
  sst: "1"
  apn: "internet"
  open5gs:
    name: "open5gs-sample"

Download open5gs-user.yaml

Apply the manifest:

kubectl apply -f open5gs-user.yaml

4.3 Modifying an Existing User

To update user values, modify the sd, sst, or apn fields in the CRD:

spec:
  sd: "222222"
  sst: "2"
  apn: "enterprise"

The new manifest should look like this:

apiVersion: net.gradiant.org/v1
kind: Open5GSUser
metadata:
  name: open5gsuser-sample
spec:
  imsi: "999700000000001"
  key: "465B5CE8B199B49FAA5F0A2EE238A6BC"
  opc: "E8ED289DEBA952E4283B54E88E6183CA"
  sd: "222222"
  sst: "2"
  apn: "enterprise"
  open5gs:
    name: "open5gs-sample"

Download open5gs-user-modified.yaml

Apply the changes:

kubectl apply -f open5gs-user-modified.yaml

5 Checking Operator Logs

To verify the operator’s actions, check the logs for any errors or warnings:

kubectl logs deployments/open5gs-operator-controller-manager