[英]How do I mount a ConfigMap volume for VMWare's fluentd operator?
I am trying to mount a Kubernetes configmap
for VMWare's Fluentd operator [ 1 ].我试图安装一个Kubernetes
configmap
为VMWare的Fluentd运营商[ 1 ]。 I've checked the documentation and the helm chart indicates that you have to specify an additional volume as a parameter called fluentd.extraVolumeMounts
我检查了文档,舵图表明您必须指定一个额外的卷作为名为
fluentd.extraVolumeMounts
的参数
The helm chart I'm using to install the operator is below :我用来安装操作员的舵图如下:
#!/bin/sh
# helmenv set to helm3
CHART_URL='https://github.com/vmware/kube-fluentd-operator/releases/download/v1.12.0/log-router-0.3.3.tgz'
# Set environment variables.
REGION='us-east-1'
CLUSTER='dev'
ENV='dev'
IMAGE_TAG='v1.12.0'
VOLUME_MOUNT="
- name: fluentd-es-templates
mountPath: /templates"
EXTRA_VOLUME="
- name: fluentd-es-templates
configMap:
name: fluentd-es-templates"
# Install the fluentd operator in kube-system.
# helm install kfo ${CHART_URL} \
helm upgrade --install kfo ${CHART_URL} \
--set meta.key=metadata \
--set meta.values.region=${REGION} \
--set meta.values.env=${ENV} \
--set meta.values.cluster=${CLUSTER} \
--set rbac.create=true \
--set image.tag=${IMAGE_TAG} \
--set image.repository=vmware/kube-fluentd-operator \
# --set fluentd.extraVolumeMounts=[$EXTRA_VOLUME]
# --set extraVolumes=[${EXTRA_VOLUME}]
When I un-comment the lines that set the volumes, the helm script fails.当我取消注释设置卷的行时,舵脚本失败。 My question is, how do I populate the
VOLUME_MOUNT
and EXTRA_VOLUME
variables with the correct json or yaml?我的问题是,如何使用正确的 json 或 yaml 填充
VOLUME_MOUNT
和EXTRA_VOLUME
变量? I'm trying to do everything in one file and don't want to split things into multiple files.我试图在一个文件中做所有事情,不想将事情分成多个文件。
You can still use a values file from within the shell script via process substitution.您仍然可以通过进程替换在 shell 脚本中使用值文件。 Here is an example:
下面是一个例子:
#!/usr/bin/env bash
CHART_URL='https://github.com/vmware/kube-fluentd-operator/releases/download/v1.12.0/log-router-0.3.3.tgz'
read -r -d '' values << EOF
meta:
key: metadata
values:
region: "us-east-1"
env: "dev"
cluster: "dev"
rbac:
create: true
image:
repository: vmware/kube-fluentd-operator
tag: "v1.12.0"
fluentd:
extraVolumeMounts:
- name: fluentd-es-templates
mountPath: /fluentd/etc/mappings
extraVolumes:
- name: fluentd-es-templates
configMap:
name: fluentd-es-templates
EOF
helm upgrade --install kfo "$CHART_URL" -f <(printf '%s' "$values")
Under the hood this creates a named pipe and passes a file descriptor such as /dev/fd/123
to the helm install command.在幕后,这会创建一个命名管道并将文件描述符(例如
/dev/fd/123
传递给 helm install 命令。 This feature is not available in some shells, such as dash ( /bin/sh
in Debian and Ubuntu).此功能在某些 shell 中不可用,例如 dash(在 Debian 和 Ubuntu 中为
/bin/sh
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.