{"id":47250127,"url":"https://github.com/niloysh/open5gs-k8s","last_synced_at":"2026-03-28T18:01:02.056Z","repository":{"id":226448307,"uuid":"665682803","full_name":"niloysh/open5gs-k8s","owner":"niloysh","description":"5G Core deployment using Open5gs on Kubernetes","archived":false,"fork":false,"pushed_at":"2025-11-18T16:02:19.000Z","size":7322,"stargazers_count":43,"open_issues_count":3,"forks_count":23,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-18T16:37:43.730Z","etag":null,"topics":["5g","k8s","open5gs"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niloysh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-12T18:52:52.000Z","updated_at":"2025-11-18T16:02:23.000Z","dependencies_parsed_at":"2024-11-11T04:23:13.498Z","dependency_job_id":"40a5eced-6424-4c26-b9f4-1eb6898da290","html_url":"https://github.com/niloysh/open5gs-k8s","commit_stats":null,"previous_names":["niloysh/open5gs-k8s"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/niloysh/open5gs-k8s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niloysh%2Fopen5gs-k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niloysh%2Fopen5gs-k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niloysh%2Fopen5gs-k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niloysh%2Fopen5gs-k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niloysh","download_url":"https://codeload.github.com/niloysh/open5gs-k8s/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niloysh%2Fopen5gs-k8s/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31116087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-28T17:50:59.904Z","status":"ssl_error","status_checked_at":"2026-03-28T17:50:59.435Z","response_time":79,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["5g","k8s","open5gs"],"created_at":"2026-03-14T13:00:21.871Z","updated_at":"2026-03-28T18:01:02.041Z","avatar_url":"https://github.com/niloysh.png","language":"Python","funding_links":[],"categories":["Lab \u0026 Testbeds"],"sub_categories":["Ready-to-Use Environments"],"readme":"# open5gs-k8s\n\nThis repository contains the necessary files and resources to deploy and operate Open5GS, an open-source 5G core network implementation. It provides Kubernetes manifest files for deploying Open5GS using microservices, an all-in-one deployment variant, and Open5GS WebUI. Additionally, there are manifest files for deploying the MongoDB database and network attachment definitions for Open5GS.\n\nFor more information about Open5GS, please visit the [Open5GS GitHub repository](https://github.com/open5gs/open5gs).\n\n![Static Badge](https://img.shields.io/badge/stable-v5.0.0-green)\n![Static Badge](https://img.shields.io/badge/open5gs-v2.7.0-green)\n![Static Badge](https://img.shields.io/badge/ueransim-v3.2.6-green)\n![Static Badge](https://img.shields.io/badge/srsran-5e6f50a-green)\n![Static Badge](https://img.shields.io/badge/k8s-v1.28.2-green)\n![Static Badge](https://img.shields.io/badge/arch-x86__64%20%7C%20arm64-green)\n\n\n## Table of Contents\n\n- [open5gs-k8s](#open5gs-k8s)\n  - [Table of Contents](#table-of-contents)\n- [Requirements](#requirements)\n- [Quick Start](#quick-start)\n- [Quick Lab VM with Multipass](#quick-lab-vm-with-multipass)\n- [Directory Structure](#directory-structure)\n- [Deployment](#deployment)\n  - [Step 1: Create a namespace for deploying Open5GS](#step-1-create-a-namespace-for-deploying-open5gs)\n  - [Step 2: Deploy MongoDB](#step-2-deploy-mongodb)\n    - [Deploy MongoDB with Kustomize](#deploy-mongodb-with-kustomize)\n    - [Check MongoDB Pod Status](#check-mongodb-pod-status)\n  - [3. Deploy the Network Attachment Definitions (NAD) for Multus](#3-deploy-the-network-attachment-definitions-nad-for-multus)\n    - [Apply Network Attachment Definitions](#apply-network-attachment-definitions)\n    - [Verify the Network Attachment Definitions](#verify-the-network-attachment-definitions)\n  - [4. Deploying Open5gs](#4-deploying-open5gs)\n    - [Deploy Open5GS components](#deploy-open5gs-components)\n      - [1. Standard Deployment:](#1-standard-deployment)\n      - [2. Deployment with Monarch for Monitoring:](#2-deployment-with-monarch-for-monitoring)\n    - [Check Deployment status](#check-deployment-status)\n    - [Verifying Deployment](#verifying-deployment)\n  - [5. Adding subscriber data](#5-adding-subscriber-data)\n    - [Deploy the Open5GS WebUI](#deploy-the-open5gs-webui)\n    - [Setting up the Admin Account](#setting-up-the-admin-account)\n    - [Accessing the WebUI](#accessing-the-webui)\n      - [Accessing the WebUI locally](#accessing-the-webui-locally)\n      - [Accessing the WebUI over SSH](#accessing-the-webui-over-ssh)\n    - [Adding subscribers](#adding-subscribers)\n    - [Using python scripts](#using-python-scripts)\n      - [1. Set up a virtual Environment](#1-set-up-a-virtual-environment)\n      - [2. Adding the admin account](#2-adding-the-admin-account)\n      - [3. Adding Subscriber information using the CLI](#3-adding-subscriber-information-using-the-cli)\n  - [6. Deploying the UERANSIM gNB](#6-deploying-the-ueransim-gnb)\n    - [Step 1: Deploy UERANSIM gNB](#step-1-deploy-ueransim-gnb)\n    - [Step 2: Verify the NGAP connection](#step-2-verify-the-ngap-connection)\n    - [Step 3: Check AMF logs](#step-3-check-amf-logs)\n  - [7. Deploying the UERANSIM UEs](#7-deploying-the-ueransim-ues)\n    - [Step 1: Deploy UEs](#step-1-deploy-ues)\n    - [Step 2: Verify UE deployment](#step-2-verify-ue-deployment)\n    - [Step 3: Check UE logs](#step-3-check-ue-logs)\n    - [Step 4: Conduct a ping test](#step-4-conduct-a-ping-test)\n    - [Step 5: Test Connectivity](#step-5-test-connectivity)\n    - [Step 6: Verify traffic through the 5G network](#step-6-verify-traffic-through-the-5g-network)\n  - [Utilities](#utilities)\n    - [Viewing Logs](#viewing-logs)\n    - [Accessing a Shell](#accessing-a-shell)\n- [IP Ranges](#ip-ranges)\n- [License](#license)\n\n## Requirements\n- Supported OS: **Ubuntu 22.04 LTS** (recommended) or Ubuntu 20.04 LTS\n- Supported CPU architectures: **x86_64** and **arm64** (tested on Apple M1/M2 hardware)\n- Minimum hardware: **2 vCPUs, 4GB RAM, 40GB disk space**\n- Kubernetes **v1.28 with Multus and OVS-CNI**: We recommend using the [testbed-automator](https://github.com/niloysh/testbed-automator) to prepare the Kubernetes cluster. This includes setting up the K8s cluster, configuring the cluster, installing various Container Network Interfaces (CNIs), configuring OVS bridges, and preparing for the deployment of the 5G Core network.\n\n\u003e [!NOTE]\n\u003e The deployments scripts assume an Ubuntu Linux environment. macOS (including Apple Silicon) and Windows users should provision an Ubuntu VM -- Multipass is the recommended option below -- and run all commands inside that guest.\n\n## Quick Start\n\nAfter you satisfy the requirements above (including running on Ubuntu—use the Multipass VM on macOS/Windows), clone this repository and run the bundled helper to deploy the full demo stack:\n\n```bash\ngit clone https://github.com/niloysh/open5gs-k8s.git\ncd open5gs-k8s\n./deploy-all.sh\n```\n\nThe `deploy-all.sh` script provisions the Open5GS core, loads the sample UERANSIM (simulated) subscribers, starts the UERANSIM gNB/UE pods, and concludes with a basic connectivity test. Use `./remove-all.sh` when you need to clean up the cluster.\n\nIf you prefer a guided walkthrough, continue with the detailed sections below or consult the slides (`slides.pdf` or `slides.md`) for an overview.\n\n## Quick Lab VM with Multipass\nIf you do not already have a Linux host available, or you are on macOS/Windows and need an Ubuntu environment, you can create a disposable VM with Multipass:\n```bash\nmultipass launch --name open5gs-test --cpus 4 --memory 4G --disk 40G jammy\nmultipass shell open5gs-test\n```\nInside the VM, follow the [testbed-automator](https://github.com/niloysh/testbed-automator) instructions to set up the required Kubernetes, then run the Quick Start commands above from within that shell. Remove the VM when you are finished with `multipass delete --purge open5gs-test`.\n\n## Directory Structure\n\nThe repository is organized as follows:\n\n- `open5gs/`: Contains Kubernetes manifest files for deploying open5gs using a microservices architecture.\n- `open5gs-webui/`: Contains Kubernetes manifest files for deploying the open5gs WebUI.\n- `mongodb/`: Contains Kubernetes manifest files for deploying the MongoDB database, which is a prerequisite for deploying open5gs.\n- `networks5g/`: Contains network attachment definitions for open5gs. \n- `ueransim/`: Contains Kubernetes files for running UERANSIM-based simulated gNB and UEs.\n- `data/`: Contains slice and subscriber configuration data.\n- `mongo-tools/`: Contains python scripts for adding/removing subscription data and automating generation of configuration files for multi-slice deployments.\n- `msd`: Multi-slice deployment of open5gs and ueransim, with configurable number of slices.\n\n## Deployment\n\nFollow these steps to deploy Open5GS on a Kubernetes cluster configured with [testbed-automator](https://github.com/niloysh/testbed-automator).\n\n\u003e [!NOTE]\n\u003e The testbed-automator defaults to a single-node cluster setup. However, if you prefer a multi-node cluster, follow the instructions for  [multi-node deployment](https://github.com/niloysh/testbed-automator?tab=readme-ov-file#multi-node-deployment). The steps below are compatible with both single-node and multi-node setups without any additional modifications.\n\n## Step 1: Create a namespace for deploying Open5GS\nWe will create a namespace for deploying all Open5GS components.\n\n```bash\nkubectl create namespace open5gs\n```\nYou can verify the creation of namespace as follows.\n```bash\nkubectl get namespaces\n```\n\n## Step 2: Deploy MongoDB\nMongoDB is used for storing subscriber information, NF profile information etc.\nMongoDB is also used in interacting with the Open5GS WebUI.\n\n**Note**: We will use [Kustomize](https://kustomize.io/), a Kubernetes-native configuration management tool. Kustomize enables you to customize Kubernetes manifest files without modifying the original YAML files directly, making it easier to manage deployments across different environments.\n\n### Deploy MongoDB with Kustomize\n\n\n```bash\nkubectl apply -k mongodb -n open5gs\n```\nThis command applies the MongoDB configuration using Kustomize, deploying MongoDB within the open5gs namespace. The manifests in this directory define the necessary resources for MongoDB, including StatefulSets, Services, and Persistent Volume Claims (PVCs), ensuring data persistence.\n\n### Check MongoDB Pod Status\n\nOnce you’ve deployed MongoDB, check the status of the MongoDB pod to ensure it’s up and running. It may take a few moments for the pod to initialize, create the necessary volumes, and enter the READY state.\n```bash\nkubectl get pods -n open5gs\n\nNAME        READY   STATUS    RESTARTS   AGE\nmongodb-0   1/1     Running   0          42s\n```\n\nIf the status shows as Running, MongoDB is ready, and you can proceed to the next step. If not, use the following command to view logs and troubleshoot potential issues:\n```\nkubectl logs mongodb-0 -n open5gs\n```\n\n## 3. Deploy the Network Attachment Definitions (NAD) for Multus\nNetwork Attachment Definitions (NADs) enable secondary network interfaces for pods in Kubernetes using the Multus CNI plugin. For Open5GS, these secondary interfaces are critical, allowing components such as the User Plane Function (UPF) and Session Management Function (SMF) to connect to distinct network segments. This configuration leverages Open Virtual Switch (OVS) with OVS-CNI to create and manage virtual networks for Open5GS components.\n\nIn this deployment, NADs are set up to link specific interfaces to preconfigured OVS bridges (n2, n3, and n4), which should already be established by the testbed-automator. These OVS bridges represent logical networks for the N2, N3, and N4 interfaces as follows:\n\n- N2: Control plane traffic between gNB and AMF.\n- N3: User data traffic between gNB and UPF.\n- N4: Control plane traffic between SMF and UPF.\n\n\u003e [!NOTE]\n\u003e You can verify the existence of the n2, n3, and n4 ovs bridges using the commands `sudo ovs-vsctl show`\n\n\n### Apply Network Attachment Definitions\nTo deploy the NADs, apply the Kubernetes manifest files in the networks5g/ directory:\n```bash\nkubectl apply -k networks5g -n open5gs\n```\nThis command will create three NADs (one each for n2, n3, and n4), allowing the UPF, SMF, and other Open5GS components to connect to these logical networks.\n\n### Verify the Network Attachment Definitions\nTo confirm that the NADs are set up correctly, run the following command:\n```bash\nkubectl get network-attachment-definition -n open5gs\n\nNAME        AGE\nn2network   10s\nn3network   10s\nn4network   10s\n```\nYou should see output similar to the above. These definitions will now allow specific Open5GS pods to use secondary network interfaces connected to the corresponding OVS bridges, enabling proper segmentation and routing of control and user plane traffic in the 5G core network.\n\n\n## 4. Deploying Open5gs\nThe Open5GS deployment uses a microservices architecture to run each network function (NF) in separate containers as Kubernetes pods, providing flexibility and scalability. This setup allows for easy management and scaling of individual NFs, such as the AMF (Access and Mobility Management Function), SMF (Session Management Function), and UPF (User Plane Function), according to specific requirements.\n\nIn this deployment, Open5GS is configured to support two network slices. Each slice has its own dedicated instance of the SMF and UPF to handle slice-specific user and control plane traffic, while other NFs, like the AMF, are shared across slices.\n\n### Deploy Open5GS components\nTo deploy Open5GS, apply the Kubernetes manifest files in the open5gs/ directory. These manifest files define each Open5GS NF as a separate pod, allowing the platform to operate in a distributed fashion.\n\nSelect one of the following deployment options based on your monitoring needs - **Standard Deployment** or **Deployment with Monarch**.\n\n\u003e [!WARNING]\n\u003e Deploy only one option at a time.\n\n\u003e [!NOTE]\n\u003e To switch deployments (e.g., from Standard to Monarch), first delete the current deployment with\n\u003e `kubectl delete -k open5gs -n open5gs`. Then proceed with the other deployment option.\n\n#### 1. Standard Deployment:\nDeploys Open5GS network functions as separate pods for a distributed setup.\n```bash\nkubectl apply -k open5gs -n open5gs\n```\n\n#### 2. Deployment with Monarch for Monitoring:\n[Monarch](https://github.com/niloysh/5g-monarch) is a network slice monitoring architecture for cloud native 5G network deployments.\n\nThis deployment option adds monitoring capabilities with Monarch for enhanced metrics tracking. Use this command instead of the standard deployment command.\n\n```bash\nkubectl apply -k msd/overlays/open5gs-metrics -n open5gs\n```\n\n\nThis command will create pods for each Open5GS NF, including AMF, SMF, UPF, and additional components needed for 5G core functionality.\n\n\u003e [!NOTE]\n\u003e Starting the network functions (NFs) may take some time as dependencies are resolved, so they may initialize sequentially. Please allow time for each NF to start up fully.\n\n### Check Deployment status\nAfter deploying Open5GS, you can monitor the status of the pods to ensure they have all reached the Running state. Run the following command to check the status of all Open5GS pods:\n```bash\nkubectl get pods -n open5gs\n```\nYou should see output similar to\n\n![open5gs-running](images/open5gs-running.png)\n\nEach NF pod should display the status Running. The SMF and UPF pods have been duplicated for each slice, as specified in the default configuration.\n\n### Verifying Deployment\n\nIf any pods are not in the Running state, check the logs for troubleshooting:\n```bash\nkubectl logs \u003cpod-name\u003e -n open5gs\n```\n\nFor example, on successfully running the AMF, you can check its logs as follows\n```bash\nkubectl logs open5gs-amf-d965784c4-688nv -n open5gs\n```\nYou should see output similar to\n```bash\nDefaulted container \"amf\" out of: amf, wait-scp (init)\nOpen5GS daemon v2.7.0\n\n10/30 21:23:03.616: [app] INFO: Configuration: '/open5gs/config/amfcfg.yaml' (../lib/app/ogs-init.c:130)\n10/30 21:23:03.616: [app] INFO: File Logging: '/open5gs/install/var/log/open5gs/amf.log' (../lib/app/ogs-init.c:133)\n10/30 21:23:03.619: [metrics] INFO: metrics_server() [http://0.0.0.0]:9090 (../lib/metrics/prometheus/context.c:299)\n10/30 21:23:03.619: [sbi] INFO: NF Service [namf-comm] (../lib/sbi/context.c:1812)\n10/30 21:23:03.620: [sbi] INFO: nghttp2_server() [http://10.244.0.35]:80 (../lib/sbi/nghttp2-server.c:414)\n10/30 21:23:03.636: [amf] INFO: ngap_server() [10.10.3.200]:38412 (../src/amf/ngap-sctp.c:61)\n10/30 21:23:03.636: [sctp] INFO: AMF initialize...done (../src/amf/app.c:33)\n10/30 21:23:03.638: [sbi] INFO: [25c6ae14-9705-41ef-be93-9b9213babecb] NF registered [Heartbeat:10s] (../lib/sbi/nf-sm.c:221)\n10/30 21:23:03.638: [sbi] INFO: [25c9bf96-9705-41ef-a6a1-afd4bf0905fe] Subscription created until 2024-10-31T21:23:03.638420+00:00 [duration:86400,validity:86399.999431,patch:43199.999715] (../lib/sbi/nnrf-handler.c:708)\n```\n\n## 5. Adding subscriber data\n\nWith the core network now up and running, we need to add subscriber data to enable connectivity. Open5GS provides a WebUI for adding and managing subscriber information. The WebUI can be accessed after deploying it with the Kubernetes manifest files in the open5gs-webui/ directory. Once deployed, it will be accessible at http://\u003cnode_ip\u003e:30300.\n\n### Deploy the Open5GS WebUI\nApply the Kubernetes manifest files from the open5gs-webui/ directory to deploy the WebUI.\n```bash\nkubectl apply -k open5gs-webui -n open5gs\n```\n### Setting up the Admin Account\n\n\u003e [!IMPORTANT]  \n\u003e Before accessing the WebUI, an admin account must be created. \n\n\nYou can use the add-admin-account.py Python script located in mongo-tools/ to add the default admin account. This script simplifies setup by configuring the initial admin credentials directly in MongoDB. See [Adding the admin account](#2-adding-the-admin-account) section.\n\nFor detailed instructions on using this script, see the [Using Python Scripts](#using-python-scripts) section below.\n\n### Accessing the WebUI\n\n#### Accessing the WebUI locally\nOnce deployed, the Open5GS WebUI will run on port 30300 on the node where Open5GS is installed. To access it:\n\n1.\tOpen a web browser.\n2.\tNavigate to http://\u003cnode_ip\u003e:30300 (replace \u003cnode_ip\u003e with the actual IP address of your deployment node).\n\nHere, you can manage subscribers, view network statistics, and configure network functions as needed.\n\nAfter adding the admin account, log in with:\n\n- Username: `admin`\n- Password: `1423`\n\n\u003e [!NOTE]\n\u003e  If you’re unable to log in, verify that the admin account was added by running the add-admin-account.py script, as outlined in the previous steps.\n\n#### Accessing the WebUI over SSH\nIf you're accessing the Open5GS host remotely over SSH, you’ll need to forward the WebUI port to your local machine to access it in a browser.\n\nTo set up SSH port forwarding, run the following command on your local machine:\n```bash\nssh -p 2222 -L 30300:127.0.0.1:30300 dev@127.0.0.1\n```\nHere:\n- -p 2222 specifies the SSH port used for connecting to the node.\n- -L 30300:127.0.0.1:30300 forwards your local port 30300 to port 30300 on the Open5GS node.\n\nThis SSH tunnel will redirect requests from your local port 30300 to port 30300 on the remote node, allowing access to the WebUI as though it were running locally.\n\nOnce connected, open your web browser and go to http://localhost:30300 to access the Open5GS WebUI.\n\nYou can add subscriber information such as IMSI, Subscriber Key, Operator Key, SNSSAI etc using the WebUI as shown below.\n\n![open5gs-webui](images/open5gs-webui.png)\n\n### Adding subscribers\nOnce you can access the WebUI, you can add the subscriber information. For testing with UERANSIM, you should add the subscriber information found in [data/sample-subscribers.md](data/sample-subscribers.md).\n\nThere are 3 sample subscribers configured to connect to two slices.\n\n   \n### Using python scripts\nPython scripts are available in this project to help automate the management of subscriber data and simplify multi-slice configuration. These scripts can add, remove, and manage subscriber entries in the MongoDB database that Open5GS relies on. They can also generate necessary configuration files for multi-slice deployments.\n\n#### 1. Set up a virtual Environment\nFirst, set up a Python virtual environment to manage dependencies.\n\n```bash\nsudo apt-get install python3-pip\nsudo pip3 install virtualenv\nvirtualenv venv\nsource venv/bin/activate\npip install -r requirements.txt\n```\n\nOnce you have activated the virtual environment, you should see your terminal prompt display the venv as shown below:\n```bash\n(venv) dev@workshop-vm:~/open5gs-k8s$ \n```\nThis means your virtual environment is activated and now your can use the python scripts.\n\n#### 2. Adding the admin account\nBefore accessing the WebUI, an admin account must be set up. To do this, use the add-admin-account.py Python script in the mongo-tools/ directory, which will automatically add a default admin account to the MongoDB database.\n\nRun the script as follows:\n\n```bash\npython mongo-tools/add-admin-account.py\n```\nYou should see an output similar to this, confirming the account creation:\n```bash\n2024-10-30 17:38:07 |     INFO | No accounts found. Adding admin account.\n```\n\nYou can now go back to [Accessing the WebUI](#accessing-the-open5gs-webui) to add subscriber information.\n\nAlternatively, you can also [add subscriber data from the command line](#3-adding-subscriber-information-using-the-cli). This may be particularly useful for batch operations or automated setups.\n\n#### 3. Adding Subscriber information using the CLI\n\nThe python scripts can be used to add subscriber information. For details see [Add subscribers using CLI](add-subscribers-using-cli.md).\n\n## 6. Deploying the UERANSIM gNB\nOnce the subscriber data is correctly inserted, we can move on to deploying the RAN.\nUERANSIM can be used to deploy a simulated monolithic gNB.\n\n### Step 1: Deploy UERANSIM gNB\n\nThe `ueransim` directory contains Kubernetes manifest files for both gNB and UEs. First, deploy UERANSIM gNB using `ueransim/ueransim-gnb` directory and wait for NGAP connection to succeed. \n\n```bash\nkubectl apply -k ueransim/ueransim-gnb/ -n open5gs\n```\n\n### Step 2: Verify the NGAP connection\n\nVerify that the NGAP connection is succesful from the gNB logs.\n```bash\nkubectl logs ueransim-gnb-\u003cpod-name\u003e -n open5gs\n```\n\u003e [!NOTE] \n\u003e Replace \u003cpod-name\u003e with the actual name of the gNB pod, which can be obtained by running kubectl get pods -n open5gs.\n\n\u003e [!TIP]\n\u003e Check out the section on [Utilities](#utilities) for a more convenient way to check logs.\n\nYou should see output indicating that the SCTP connection is established and the NG Setup procedure is successful, similar to the following:\n```bash\nUERANSIM v3.2.6\n[2024-10-31 16:18:35.073] [sctp] [info] Trying to establish SCTP connection... (10.10.3.200:38412)\n[2024-10-31 16:18:35.075] [sctp] [info] SCTP connection established (10.10.3.200:38412)\n[2024-10-31 16:18:35.075] [sctp] [debug] SCTP association setup ascId[4549]\n[2024-10-31 16:18:35.075] [ngap] [debug] Sending NG Setup Request\n[2024-10-31 16:18:35.082] [ngap] [debug] NG Setup Response received\n[2024-10-31 16:18:35.082] [ngap] [info] NG Setup procedure is successful\n```\n### Step 3: Check AMF logs\n\nWe should also be able to see the logs from the AMF indicating a successful NGAP connection with the gNB.\n\n```bash\nkubectl logs -f open5gs-amf-d965784c4-cxvgt -n open5gs\n```\nYou should see log entries indicating the successful registration of the gNB, such as:\n```bash\n10/31 18:06:17.538: [sbi] INFO: (NRF-notify) NF registered [d3371fa4-97b2-41ef-acbb-55f392fb7b64:1] (../lib/sbi/nnrf-handler.c:924)\n10/31 18:06:17.538: [sbi] INFO: [NSSF] (NRF-notify) NF Profile updated [d3371fa4-97b2-41ef-acbb-55f392fb7b64:1] (../lib/sbi/nnrf-handler.c:938)\n10/31 18:10:50.260: [amf] INFO: gNB-N2 accepted[10.10.3.231]:53505 in ng-path module (../src/amf/ngap-sctp.c:113)\n10/31 18:10:50.260: [amf] INFO: gNB-N2 accepted[10.10.3.231] in master_sm module (../src/amf/amf-sm.c:741)\n10/31 18:10:50.273: [amf] INFO: [Added] Number of gNBs is now 1 (../src/amf/context.c:1231)\n10/31 18:10:50.273: [amf] INFO: gNB-N2[10.10.3.231] max_num_of_ostreams : 10 (../src/amf/amf-sm.c:780)\n```\n\n\n\n## 7. Deploying the UERANSIM UEs\n\nNow that the gNB is deployed, we can proceed to deploy UERANSIM UEs using `ueransim/ueransim-ue/` directory.\n\n### Step 1: Deploy UEs\n\n```bash\nkubectl apply -k ueransim/ueransim-ue -n open5gs\n```\nThis will deploy 2 simulated UEs, ue1 and ue2 which connects to our 2 network slices.\n\n### Step 2: Verify UE deployment\nYou can verify that the UEs have been deployed by the `kubectl get pods -n open5gs` command. You should see output similar to the one below, indicating that the simulated UEs have been deployed.\n\n```bash\nueransim-ue1-6df4cb95b-nq2m5     1/1     Running   0              6s\nueransim-ue2-6d5cc8487-58fvf     1/1     Running   0              6s\n```\n\n### Step 3: Check UE logs\n\nThe UEs should now connect to the gNB and establish a PDU session with the 5G core network. To verify this, check the logs of ue1:\n```bash\nkubectl logs ueransim-ue1-\u003cpod-id\u003e -n open5gs\n```\nYou should see logs similar to the following, indicating successful PDU session establishment:\n\n```bash\n[2024-10-31 18:18:44.062] [nas] [debug] Sending PDU Session Establishment Request\n[2024-10-31 18:18:44.062] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]\n[2024-10-31 18:18:44.267] [nas] [debug] Configuration Update Command received\n[2024-10-31 18:18:44.293] [nas] [debug] PDU Session Establishment Accept received\n[2024-10-31 18:18:44.293] [nas] [info] PDU Session establishment is successful PSI[1]\n[2024-10-31 18:18:44.319] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 10.41.0.2] is up.\n```\n\n### Step 4: Conduct a ping test\n\nOnce the PDU session is established, we can conduct a ping test from the UEs. We can open up a shell on the ue1 pod as shown.\n\n```bash\nkubectl exec -it ueransim-ue1-\u003cpod-id\u003e -n open5gs -- /bin/bash\n\nroot@ueransim-ue1-6df4cb95b-nq2m5:/ueransim# \n```\n\nOnce inside the pod, we can look at the interfaces as follows:\n\n```bash\nip a\n```\nYou should see the interfaces similar to the one below:\n```bash\nroot@ueransim-ue1-6df4cb95b-nq2m5:/ueransim# ip a\n3: uesimtun0: \u003cPOINTOPOINT,PROMISC,NOTRAILERS,UP,LOWER_UP\u003e mtu 1400 qdisc fq_codel state UNKNOWN group default qlen 500\n    link/none \n    inet 10.41.0.2/32 scope global uesimtun0\n       valid_lft forever preferred_lft forever\n    inet6 fe80::917c:fa60:d6ea:9ddc/64 scope link stable-privacy \n       valid_lft forever preferred_lft forever\n```\n\nNote that a tunnel interface `uesimtun0` has been created denoting the UE's connection to the 5G network, with an IP in the range `10.41.0.0/16` If using a COTS UE, this would be the IP assigned to the UE. This IP range is specified in our core configuration, in the [SMF config file](open5gs/slices/slice1/smf1/smf-configmap.yaml#L45).\n\n### Step 5: Test Connectivity\n\nLet's test this by sending pings to google.ca using the `uesimtun0` interface.\n\n```bash\nping -I uesimtun0 www.google.ca \n```\nYou should see output similar to the below:\n```bash\nroot@ueransim-ue1-6df4cb95b-nq2m5:/ueransim# ping -I uesimtun0 www.google.ca \nPING www.google.ca (142.251.33.163) from 10.41.0.2 uesimtun0: 56(84) bytes of data.\n64 bytes from yyz10s17-in-f3.1e100.net (142.251.33.163): icmp_seq=1 ttl=59 time=8.24 ms\n64 bytes from yyz10s17-in-f3.1e100.net (142.251.33.163): icmp_seq=2 ttl=59 time=6.19 ms\n64 bytes from yyz10s17-in-f3.1e100.net (142.251.33.163): icmp_seq=3 ttl=59 time=7.66 ms\n```\n\n### Step 6: Verify traffic through the 5G network\nTo verify that the pings are indeed going through the 5G network, leave the pings running, open up a new terminal, and we can open up a shell on the UPF1 pod (recall that ue1 is connected to slice1, and slice1 has upf1) as follows:\n\n```bash\nkubectl exec -it open5gs-upf1-866d8bb994-5bj4x -n open5gs -- /bin/bash\n```\nOnce inside the container, we can check the interfaces using `ip a` and see the following:\n\n```bash\nroot@open5gs-upf1-866d8bb994-5bj4x:/open5gs/install/bin# ip a\n5: ogstun: \u003cPOINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP\u003e mtu 1500 qdisc fq_codel state UP group default qlen 500\n    link/none \n    inet 10.41.0.1/16 scope global ogstun\n       valid_lft forever preferred_lft forever\n```\n\nNote that a tunnel interface has been created in the UPF as well representing the GTP-U tunnel endpoint of the N3 interface.\n\nWe can capture packets on this interface using `tcpdump` as follows:\n\n```bash\ntcpdump -i ogstun\n```\n\nYou should see ping traffic appearing as follows:\n```bash\nroot@open5gs-upf1-866d8bb994-5bj4x:/open5gs/install/bin# tcpdump -i ogstun \ntcpdump: verbose output suppressed, use -v[v]... for full protocol decode\nlistening on ogstun, link-type RAW (Raw IP), snapshot length 262144 bytes\n18:34:29.550600 IP vpn-uw-ft-10-41-0-2.campus-dynamic.uwaterloo.ca \u003e yyz10s17-in-f3.1e100.net: ICMP echo request, id 48, seq 212, length 64\n18:34:29.556545 IP yyz10s17-in-f3.1e100.net \u003e vpn-uw-ft-10-41-0-2.campus-dynamic.uwaterloo.ca: ICMP echo reply, id 48, seq 212, length 64\n18:34:30.552845 IP vpn-uw-ft-10-41-0-2.campus-dynamic.uwaterloo.ca \u003e yyz10s17-in-f3.1e100.net: ICMP echo request, id 48, seq 213, length 64\n18:34:30.558190 IP yyz10s17-in-f3.1e100.net \u003e vpn-uw-ft-10-41-0-2.campus-dynamic.uwaterloo.ca: ICMP echo reply, id 48, seq 213, length 64\n```\n\nCongratulations! You have setup a 5G network and simulated RAN and UEs and sent traffic through the network.\n\n\n\n## Utilities\nThe `bin` directory contains utility scripts designed for convenient log viewing and accessing a shell for any network function (NF). \n\n### Viewing Logs\nTo view the logs of a specific NF, use the following command:\n```bash\n./bin/k8s-log.sh \u003cnf\u003e \u003cnamespace\u003e\n```\n**Example:**\n```bash\n./bin/k8s-log.sh amf open5gs\n```\n\n### Accessing a Shell\nTo open a shell session in any NF, use:\n```bash\n./bin/k8s-shell.sh \u003cnf\u003e \u003cnamespace\u003e\n```\n**Example:**\n```bash\n./bin/k8s-shell.sh upf1 open5gs\n```\n\n## IP Ranges\nThis project uses overlay IPs for tunnels deployed with the OVS-CNI in Kubernetes. The CNI configuration is outlined in the `networks5g/`. \n\n- `n2network` as IP `10.10.2.0/24`, `n3network` has IP `10.10.3.0/24`, `n4network` has IP `10.10.4.0/24`.\n- Due to constraints in srsRAN, both AMF and gNB currently utilize the `n3network` instead of `n2network`.\n- UPF N3 IP range is from `10.10.3.X` from `UPFX`. UPF N4 IP range is from `10.10.4.X` for `UPFX`.\n- SMF N4 IP range is from `10.10.4.{100 + X}` from `SMFX`\n- AMF IP range is from `10.10.3.200` to `10.10.3.230`.\n- gNB IP range is from `10.10.3.231` to `10.10.3.250`.\n\nPlease use the above conventions when connecting external gNBs, e.g., srsRAN.\n\n\n## License\nThis repository is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniloysh%2Fopen5gs-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniloysh%2Fopen5gs-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniloysh%2Fopen5gs-k8s/lists"}