kubernetes 将toml配置文件添加到helm图表中

z9smfwbn  于 2022-12-17  发布在  Kubernetes
关注(0)|答案(1)|浏览(124)

我是舵手的新手,我正在尝试添加静态的.toml配置文件到舵手图表中,但是部署清单的内容让我很困扰,这是我的图表树。

.
├── Chart.yaml
├── telegraf.conf
└── templates
    └── configmap.yaml

configmap.yaml

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: telegraf-api
data:
  {{ (.Files.Glob "telegraf.conf").AsConfig | indent 4 }}

telegraf.conf

[global_tags]
[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = "0s"
  hostname = ""
  omit_hostname = false
[[inputs.cpu]]
  percpu = true
  totalcpu = true
  collect_cpu_time = false
  report_active = false
  core_tags = false
[[inputs.disk]]
  ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]

我可以毫无问题地安装图表,但是当我检查已部署的清单(它有很多像这样的反斜杠)时,问题出现了:

$ helm get manifest telegraf
---
# Source: telegraf/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: telegraf-api
data:
      telegraf.conf: "[global_tags]\n[agent]\n  interval = \"10s\"\n  round_interval = true\n
      \ metric_batch_size = 1000\n  metric_buffer_limit = 10000\n  collection_jitter =
      \"0s\"\n  flush_interval = \"10s\"\n  flush_jitter = \"0s\"\n  precision = \"0s\"\n
      \ hostname = \"\"\n  omit_hostname = false\n[[inputs.cpu]]\n  percpu = true\n  totalcpu
      = true\n  collect_cpu_time = false\n  report_active = false\n  core_tags = false\n[[inputs.disk]]\n
      \ ignore_fs = [\"tmpfs\", \"devtmpfs\", \"devfs\", \"iso9660\", \"overlay\", \"aufs\",
      \"squashfs\"]\n[[inputs.diskio]]\n[[inputs.kernel]]\n[[inputs.mem]]\n[[inputs.processes]]\n[[inputs.swap]]\n[[inputs.system]]\n
      \ "

有没有人想过如何部署它,使配置不会变得混乱?

nkkqxpd9

nkkqxpd91#

这不会导致配置出现任何问题。配置文件中的反斜线用于指示该行应在下一行继续。将configmap加载到pod时,将正确加载实际的键值对。

相关问题