Skip to content

Deploying OpenAirInterface Core and RAN in k8s

Angelo Feraudo edited this page Dec 4, 2025 · 15 revisions

Creating k8s namespaces

Create core and ran namespace

kubectl create ns oai-core

kubectl create ns oai-ran

Deploying Core

Clone repository with helm charts:

# Chart definitions (k8s deployments)
git clone https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed.git

Change branch

cd oai-cn5g-fed 

# Be sure to be in the master branch
git status

❗ Note: Core side the version used of each nfv is v2.0.1. However, this is useful for RAN side pods (UEs and gNB)

It will be good to configure an image pull secret to pull images from docker-hub because of the anonymous pull limit of 100 in docker-hub. This may cause some pods to remain in NOT READY state.

Screenshot 2024-08-14 153243

Configure docker-hub image pull secret:

kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>

Fetch missing dependencies

cd oai-cn5g-fed/charts/oai-5g-core/oai-5g-basic/
helm dependency update

Install charts

cd ..
helm install basic oai-5g-basic/ -n oai-core

Check the logs smf and upf to see that the PFCP session is properly configured

kubectl logs -l app.kubernetes.io/name=oai-smf -n oai-core | grep 'handle_receive(16 bytes)' | wc -l
kubectl logs -l app.kubernetes.io/name=oai-upf -n oai-core | grep 'handle_receive(16 bytes)' | wc -l

If the value is more than 1 for both then it will verify that smf and upf have successfully registered to nrf and there is a PFCP session.

❗ Note: This tutorial is extracted from this oai tutorial.

Deploying RAN

Create your custom image for the gNB (optional -- skip this step if you're following the tutorial)

❗ Note: Our xApp has been tested with the FlexRIC E2Agent at commit f1c08ed2. Other versions have not yet been validated, so using them may result in potential issues such as E2 disconnections, xApp subscription failures, and other unexpected behavior.

⚠️ Warning: This procedure may require more than 30 minutes!

First, we need to clone the github repository

git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git
cd openairinterface5g 

Now, we build the gNB image using 3 custom Docker files that you can find in this folder

# Copy the docker files provided in this repository in the docker directory
# Supposing that docker files are in a path like ORANInABox/docker and you are in the openairinterface5g directory
cp ORANInABox/docker/* docker

# Build ran-base image
docker build --target ran-base --tag ran-base:latest --file docker/Dockerfile.base.ubuntu22.custom .

Create ran-build-sim image. This is a custom version that builds also the service models provided in the flexric project. Be sure that the openair2/E2AP/flexric is not empty. If it's empty run the following commands

# You should use a specific branch of the E2Agent
git submodule init
git submodule update

Now, we can build the image

# Build the image
docker build --target ran-build-sim --tag ran-build-sim:latest --file docker/Dockerfile.build.ubuntu22.sim .

Finally, we build the gNB image

docker build --target oai-gnb-sim --tag oai-gnb-sim:latest --file docker/Dockerfile.gNB.ubuntu22.custom .
# Give it a tag
docker tag oai-gnb-sim local/oai-gnb

Once you have built the image, you can load it in minikube

minikube image load local/oai-gnb

Deploying gNB Using a pre-built Image

We will use the charts provided by the previous repo, but we need to make some changes.

cd oai-cn5g-fed/charts/oai-5g-ran
nano oai-gnb/values.yaml
nfimage:   # image name either locally present or in a public/private repository
  # repository: docker.io/oaisoftwarealliance/oai-gnb
  # version: 2023.w49 # image tag or develop
  repository: angeloferaudo/oai-gnb-sim # comment this if you want to use a custom image
  # repository: local/oai-gnb # uncomment this if you want to use a custom image (to build it look at the previous step)
  version: latest
  pullPolicy: IfNotPresent
#...

config:
  amfhost: "oai-amf.oai-core"
  #...

You can find the values.yaml file with the needed changes here.

Now, we can deploy the gNB in minikube using helm

helm install gnb oai-gnb --namespace oai-ran

To test that the gNB is correctly connected to the amf run the following command

kubectl logs --namespace oai-core $(kubectl get pods --namespace oai-core | grep oai-amf| awk '{print $1}') | grep 'Connected'

You should have an output like the following

[2024-08-19 13:55:42.274] [amf_app] [info] |      1      |    Connected     |        0xe000        |       oai-gnb-rfsim           |               001, 01              |

Deploying UE

Go to the directory containing the charts for RAN deployments

cd oai-cn5g-fed/charts/oai-5g-ran

Change the charts to use the develop version of the nrue image

nfimage:
  repository: docker.io/oaisoftwarealliance/oai-nr-ue           # dockehub oaisoftwarealliance/oai-nr-ue
  version: develop # image tag or develop
  # pullPolicy: IfNotPresent or Never or Always
  pullPolicy: IfNotPresent

#...
# Comment also the following line
config:
#  sd: "16777215"
# ...

The values.yaml file can be found here.

Now, you can deploy the UE using helm

helm install nrue oai-nr-ue/ -n oai-ran

To verify that the UE received an IP address run

kubectl exec -it -n oai-ran -c nr-ue $(kubectl get pods -n oai-ran | grep oai-nr-ue | awk '{print $1}') -- ifconfig oaitun_ue1 |grep -E '(^|\s)inet($|\s)' | awk {'print $2'}