How to create logfile when running in docker/kubernetes?

Hi all,
I want to setup a new Node-RED instance with kubernetes (Microk8s) and docker. I got it running using a directory on the host for /data. However, I don't know how to redirect the console output into a logfile that is written either to /data or to any other directory that I can also mount from my host. Any help is appreciated!

Here is for your reference my deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nodered
  labels:
    app: nodered
  namespace: smart-home
spec:
  selector:
    matchLabels:
      app: nodered
  replicas: 1
  template:
    metadata:
      labels:
        app: nodered
    spec:
      containers:
      - name: nodered
        image: nodered/node-red-docker
        imagePullPolicy: Always
        resources:
          limits:
            cpu: 0.5
            memory: 500Mi
        ports:
        - containerPort: 1880
        volumeMounts:
        - name: nodered-data
          mountPath: /data
      volumes:
      - name: nodered-data
        hostPath:
          # directory location on host
          path: /home/auberger/k8s/nodered/pv/data
          # this field is optional
          type: Directory

I just found out by chance how that the log is written automatically and how it can be read:
kubectl logs <pod-name> -n <namespace>

As an example this would be in the case of my currently running system:
kubectl logs nodered-596f677d88-xbfw8 -n smart-home

I hope this is helpful for someone else looking for an answer.