Open liuxue-2000 opened 1 week ago
Hi @liuxue-2000 , I have carefully reviewed your question.
First, in klog v1.0.0, the options --log_dir
and --log_file
cannot be used simultaneously. You can find more details here.
Second, if you built the image using the project's Dockerfile or Dockerfile.multi, please note that the image runs the program with non-root permissions. This means it won't work even if you start it with root permissions.
Lastly, to save logs to a specific directory or file, you will need to use Kubernetes Storage. You can find more information here.
Below is an example of a Deployment configuration that saves logs to a host directory:
containers:
- command:
- /kube-eventer
- '--source=<source>'
- >-
--sink=<sink>
- '--log_dir=/var/log/kube-eventer'
...
volumeMounts:
- mountPath: /var/log/kube-eventer
name: volume-1732240867108
...
volumes:
- hostPath:
path: /tmp
type: ''
name: volume-1732240867108
你好@liuxue-2000,我仔细审阅了您的问题。
首先,在 klog v1.0.0 中,选项
--log_dir
和--log_file
不能同时使用。你可以在这里找到更多详细信息。其次,如果你使用项目的Dockerfile或Dockerfile.multi构建了镜像,请注意,镜像以非 root 权限运行程序。这意味着即使你以 root 权限启动它,它也不会起作用。
最后,要将日志保存到特定目录或文件,您需要使用 Kubernetes Storage。您可以在此处找到更多信息。
以下是将日志保存到主机目录的部署配置示例:
containers: - command: - /kube-eventer - '--source=<source>' - >- --sink=<sink> - '--log_dir=/var/log/kube-eventer' ... volumeMounts: - mountPath: /var/log/kube-eventer name: volume-1732240867108 ... volumes: - hostPath: path: /tmp type: '' name: volume-1732240867108
I understand, thank you
配置如下,在镜像中已授权,并使用root启动
是还需要其他权限?还是哪里配置不对呢