free5gc-helm
Prerequirements
-
Install
-
MicroK8s
sudo snap install microk8s --classic --channel=1.28/stable -
kubectl
sudo snap install kubectl --classic -
helm
sudo snap install helm --classic
-
-
Set
sudogroup and joinsudo groupadd microk8s sudo usermod -aG microk8s $USER newgrp microk8s -
Set
microk8swork with localkubectlmkdir -p ~/.kube chmod 0700 ~/.kube microk8s config > ~/.kube/config
IP Forward Configuration
Note
Reference: Calico CNI Docs.
-
Starting from version 1.19, MicroK8s clusters use the Calico CNI by default.
- To enable IP forwarding on UPF, Calico CNI needs some necessary configurations.
- Some CNI plugin, like Flannel, kube-ovn, allow this funtionality by default.
-
Setup Calico CNI for IP forwarding:
-
Edit
/var/snap/microk8s/current/args/cni-network/cni.yaml... kind: ConfigMap ... data: ... cni_network_config: |- { ... "plugins": [ { "type": "calico", ... "kubernetes": { "kubeconfig": "__KUBECONFIG_FILEPATH__" }, # append IP forwarding settings "container_settings": { "allow_ip_forwarding": true }, } ] }
-
-
Setup kubelet args for IP fowarding:
-
Edit
/var/snap/microk8s/current/args/kubelet# append this arg --allowed-unsafe-sysctls "net.ipv4.ip_forward"
-
-
Apply settings and restart MicroK8s
# apply cni configuration kubectl apply -f /var/snap/microk8s/current/args/cni-network/cni.yaml # restart MicroK8s microk8s stop microk8s start
Addons Enable
Note
Reference:
microk8s enable community
microk8s enable multus
microk8s enable hostpath-storage
Create Persistent Volumn
-
Create two storage directories:
- One for mongo:
/home/usr/mongo<= just an example - One for cert:
/home/use/cert<= just an example
- One for mongo:
-
For mongodb
- Create an storage directory:
/home/usr/mongo<= just an example -
Create an YAML file:
persistent-vol-for-mongodb.yamlapiVersion: v1 kind: PersistentVolume metadata: name: free5gc-pv-mongo labels: project: free5gc spec: capacity: storage: 8Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: microk8s-hostpath local: path: <mongo_storage_dir> # edit to your own path, like: /home/use/mongo nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: - <work_node_name> # edit to you node name -
Apply via
kubectlkubectl apply -f persistent-vol-for-mongodb.yaml
- Create an storage directory:
-
For cert
- Create an storage directory:
/home/usr/cert<= just an example -
Create an YAML file:
persistent-vol-for-cert.yamlapiVersion: v1 kind: PersistentVolume metadata: name: free5gc-pv-cert labels: project: free5gc spec: capacity: storage: 2Mi accessModes: - ReadOnlyMany persistentVolumeReclaimPolicy: Retain storageClassName: microk8s-hostpath local: path: <cert_storage_dir> # edit to your own path, like: /home/use/cert nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: - <work-node-name> # edit to you node name -
Apply via
kubectlkubectl apply -f persistent-vol-for-cert.yaml
- Create an storage directory:
-
Check it
kubectl get pv
Helm Chart
-
Clone from github
git clone https://github.com/free5gc/free5gc-helm.git
Network configuration
Note
Reference: Toward5Gs -- Network Configuration
-
In summary, the
value.yamlin each configuration should be set up correctly.- free5gc-helm offered a network configuration YAML file at
free5gc-helm/charts/free5gc/value.yaml. - For
N2/N3/N4/N6/N9interfaces, themasterIfand otherIPfield should be modified for customized deployment.
- free5gc-helm offered a network configuration YAML file at
-
(Optional) These values could also be setup by using
helm install --set.helm install -n free5gc free5gc-helm ./free5gc/ \ --set global.n6network.subnetIP="x.x.x.x" \ --set global.n6network.gatewayIP="y.y.y.y" \ --set free5gc-upf.upf.n6if.ipAddress="z.z.z.z"
Install Chart
-
Set working namespace for free5GC
kubectl create ns free5gc -
Install free5GC charts
cd free5gc-helm/charts helm install -n free5gc free5gc-helm ./free5gc/ -
Install UERANSIM chart
cd free5gc-helm/charts helm install -n free5gc ueransim ./ueransim/ -
Check installation
-
Check installed charts
helm ls -A -
Check services, pods, replicates and deployments
# status at each pod is expected as "Running" kubectl get all -n free5gc
-
-
Check IP forwarding is available at UPF
# output should be '1' kubectl exec -it -n free5gc deployment/free5gc-helm-free5gc-upf-upf \ -- cat /proc/sys/net/ipv4/ip_forward
Test
-
Add subscribers via web console
-
Access
`<external_ip>:30500
-
-
Ping external network with GTP-Tunnel
kubectl exec -it -n free5gc deployment/ueransim-ue \ -- ping -I uesimtun0 8.8.8.8