将 dnsmasq.conf 文件重定向到其他文件

Redirect dnsmasq.conf file to some other file

如何将 dnsmasq.conf 文件从 /etc/dnsmasq.conf 重定向到另一个文件?尝试通过 ceph-csi 使用 pvc 在 kubernetes 上使用 dnsmasq 配置 statefulset pod,但无法将 pvc 安装到配置文件,只有可用于安装的文件夹。如果我尝试将 pvc 挂载到 /etc/ 文件夹中的所有内容都会消失,并且由于 dnsmasq 所需的所有文件夹都在那里,所以我无法启动程序。我想到了一个解决方案,使用另一个 folder/file 作为配置文件应用,但我不知道我在哪里可以做到这一点。

根据 dnsmasq 的手册,似乎可以指定 dnsmasq.conf 文件所在的目录。参考:https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

-C, --conf-file= Specify a configuration file. The presence of this option stops dnsmasq from reading the default configuration file (normally /etc/dnsmasq.conf). Multiple files may be specified by repeating the option either on the command line or in configuration files. A filename of "-" causes dnsmasq to read configuration from stdin.

因此,您可以将文件挂载到任何您想要的目录。然后,使用容器的 --conf-file 参数指向该文件。