1

I am trying to deploy the free5gc core in k8s using microk8s and I have this problem only with the UPF function. This is the error I get when I start the function with the command written inside the Dockerfile as ENTRYPOINT:

2022-04-12T13:13:40Z [INFO][UPF][Util] UPF log: /log/upf.log
2022-04-12T13:13:40Z [INFO][UPF][Util] Config: /upfcfg.yaml
2022-04-12T13:13:40Z [INFO][UPF][Util] UPF config version [1.0.0]
2022-04-12T13:13:40Z [INFO][UPF][Util] Set log level: info
2022-04-12T13:13:40Z [WARN][UPF][Util] Unknown key "DefaultServiceIP" of configuration
2022-04-12T13:13:40Z [ERRO][UPF][Util] 
2022-04-12T13:13:40Z [INFO][UPF][Util] DNN routes added, main routing table:
2022-04-12T13:13:40Z [INFO][UPF][Util] DstIp               Gateway        Iface     Priority RtProto   Type
2022-04-12T13:13:40Z [INFO][UPF][Util] 169.254.1.1 /32     0.0.0.0        eth0      0        boot      unicast
2022-04-12T13:13:40Z [INFO][UPF][Util] 60.60.0.0 /24       0.0.0.0        upfgtp    0        static    unicast
2022-04-12T13:13:40Z [INFO][UPF][Util] 0.0.0.0 /0          169.254.1.1    eth0      0        boot      unicast
2022-04-12T13:13:40Z [ERRO][UPF][Util] No PFCP Server
2022-04-12T13:13:40Z [ERRO][UPF][Util] 
2022-04-12T13:13:40Z [ERRO][UPF][Util] UPF - PFCP error when UPF initializes
2022-04-12T13:13:40Z [ERRO][UPF][Util] UPF failed to initialize
2022-04-12T13:13:40Z [INFO][UPF][Util] Removing DNN routes

But if I delete the ENTRYPOINT inside the Dockerfile, start the pod, entering inside the container and then running the function manually, it works:

2022-04-12T13:13:40Z [INFO][UPF][Util] UPF log: /log/upf.log
2022-04-12T13:13:40Z [INFO][UPF][Util] Config: /upfcfg.yaml
2022-04-12T13:13:40Z [INFO][UPF][Util] UPF config version [1.0.0]
2022-04-12T13:13:40Z [INFO][UPF][Util] Set log level: info
2022-04-12T13:13:40Z [WARN][UPF][Util] Unknown key "DefaultServiceIP" of configuration
2022-04-12T13:13:40Z [INFO][UPF][Util] DNN routes added, main routing table:
2022-04-12T13:13:40Z [INFO][UPF][Util] DstIp               Gateway        Iface     Priority RtProto   Type
2022-04-12T13:13:40Z [INFO][UPF][Util] 169.254.1.1 /32     0.0.0.0        eth0      0        boot      unicast
2022-04-12T13:13:40Z [INFO][UPF][Util] 60.60.0.0 /24       0.0.0.0        upfgtp    0        static    unicast
2022-04-12T13:13:40Z [INFO][UPF][Util] 0.0.0.0 /0          169.254.1.1    eth0      0        boot      unicast
2022-04-12T13:13:40Z [INFO][UPF][Util] Removing DNN routes

This is the Dockerfile of the UPF function:

FROM ubuntu:20.04
COPY . .
COPY libgtp5gnl.so.0 /usr/local/lib
COPY liblogger.so /usr/local/lib
RUN apt-get update && apt-get install -y net-tools vim iputils-ping libmnl-dev libyaml-dev
#ENTRYPOINT ["./free5gc-upfd", "-c", "upfcfg.yaml"]
CMD ["sh", "-c", "tail -f /dev/null"]

In order to be able to run the function, I have a configuration file(upfcfg.yaml) that must be specified. This is the command that must be run in order to start the UPF:

./free5gc-upfd -c upfcfg.yaml

This is the configuration file:

info:
  version: 1.0.0
  description: UPF configuration

configuration:
  # the kind of log output
    # debugLevel: how detailed to output, value: trace, debug, info, warn, error, fatal, panic
    # ReportCaller: enable the caller report or not, value: true or false
  debugLevel: info
  ReportCaller: false

  # packetBufferHoldTime should be longer than Paging retry-out time of AMF.
  # unit: seconds
  packetBufferHoldTime: 30

  DefaultServiceIP: upf-service

  # The IP list of the N4 interface on this UPF (Can't set to 0.0.0.0)
  pfcp:
    - addr: upf-service

  # The IP list of the N3/N9 interfaces on this UPF
  # If there are multiple connection, set addr to 0.0.0.0 or list all the addresses
  gtpu:
    - addr: 0.0.0.0
    # [optional] gtpu.name
    # - name: upf.5gc.nctu.me
    # [optional] gtpu.ifname
    # - ifname: gtpif

  # The DNN list supported by UPF
  dnn_list:
    - dnn: internet # Data Network Name
      cidr: 60.60.0.0/24 # Classless Inter-Domain Routing for assigned IPv4 pool of UE
      # [optional] dnn_list[*].natifname
      # natifname: eth0

where upf-service is the name of the Service created in k8s.

This is the yaml file for the UPF Service:

apiVersion: v1
kind: Service
metadata:
  name: upf-service
  labels:
    app: free5gc-upf
spec:
  type: ClusterIP
  selector:
    app: free5gc-upf
  clusterIP: None
  ports:
  - name: sbi
    targetPort: 29518
    port: 29518
    protocol: TCP
  - name: upf-n3
    protocol: UDP
    targetPort: 2152
    port: 2152
  - name: upf-n4
    targetPort: 8805
    port: 8805
    protocol: UDP

And the yaml file for the Deployment:

apiVersion: apps/v1 
kind: Deployment
metadata:
  name: upf-deployment
spec:
  selector:
    matchLabels:
      app: free5gc-upf
  replicas: 1
  template:
    metadata:
      labels:
        app: free5gc-upf
    spec:
      containers:      
      - name: myapp-container
        image: andresache/upf
        ports:
        - containerPort: 29518
          name: upf-sbi
          protocol: TCP        
        - containerPort: 2152
          name: upf-n3
          protocol: UDP
        - containerPort: 8805  
          name: upf-n4
          protocol: UDP
        imagePullPolicy: Always
        securityContext:
          privileged: true
          capabilities:
            add: ["NET_ADMIN", "NET_RAW", "NET_BIND_SERVICE", "SYS_TIME"]
            # lifecycle:
            #postStart:
            #exec:
            # command: ["/bin/sh", "-c", "sleep 5; ./free5gc-upfd -c upfcfg.yaml"]
      dnsPolicy: ClusterFirst

About the source code of the upf function, I will leave the link with the repository that contains it, as it is pretty long and complex: https://github.com/free5gc/upf/tree/31b765226b2ad862df3e373234c60dfd6ff1e782/src

Do you have any idea why it works inside the container, but not otherwise? Thanks!

  • 2
    Without a [mcve] it's really hard to tell what might be going on. Can you [edit] the question to include enough source code to demonstrate the error, and the actual error messages? Make sure to include these details directly in the question (not behind links) in plain text (not image files). – David Maze Apr 12 '22 at 10:27
  • 2
    @DavidMaze, thanks for the reply, I just edited the post. Please let me know if you need anything else – Andres Pasca Apr 12 '22 at 14:16

0 Answers0