free5gc-helm
Prerequirements
-
Install
-
MicroK8s
bash sudo snap install microk8s --classic --channel=1.28/stable -
kubectl
bash sudo snap install kubectl --classic -
helm
bash sudo snap install helm --classic
-
-
Set
sudogroup and joinbash sudo groupadd microk8s sudo usermod -aG microk8s $USER newgrp microk8s -
Set
microk8swork with localkubectlbash mkdir -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.yamlyaml ... 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```bash
append this arg
--allowed-unsafe-sysctls "net.ipv4.ip_forward"
```
-
-
Apply settings and restart MicroK8s
```bash
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:
bash
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.yamlyaml apiVersion: 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
kubectlbash kubectl 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.yamlyaml apiVersion: 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
kubectlbash kubectl apply -f persistent-vol-for-cert.yaml
- Create an storage directory:
-
Check it
bash kubectl get pv
Helm Chart
-
Clone from github
bash 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.bash 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
bash kubectl create ns free5gc -
Install free5GC charts
bash cd free5gc-helm/charts helm install -n free5gc free5gc-helm ./free5gc/ -
Install UERANSIM chart
bash cd free5gc-helm/charts helm install -n free5gc ueransim ./ueransim/ -
Check installation
-
Check installed charts
bash helm ls -A -
Check services, pods, replicates and deployments
```bash
status at each pod is expected as "Running"
kubectl get all -n free5gc
```
-
-
Check IP forwarding is available at UPF
```bash
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
bash kubectl exec -it -n free5gc deployment/ueransim-ue \ -- ping -I uesimtun0 8.8.8.8