是否可以使用kubernetes_config_map资源--from-file ConfigMap? [英] Is it possible --from-file ConfigMap using kubernetes_config_map resource?
本文介绍了是否可以使用kubernetes_config_map资源--from-file ConfigMap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Terraform部署Metallb. metallb的配置如下.
I want to deploy metallb using terraform. metallb configuration is as follows.
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- 172.16.99.1-172.16.99.255
是否可以使用kubernetes_config_map资源部署--from-file配置?
Is it possible deploy such --from-file configuration using kubernetes_config_map resource?
推荐答案
您可以使用 file()插值函数以读取文件内容.可能看起来像:
You can use the file() interpolation function to read the file contents. That might look like:
resource "kubernetes_config_map" "config" {
metadata {
namespace = "metallb_system"
name = "config"
}
data {
config = "${file(${path.module}/config.yml)}"
}
}
与kubectl create configmap --from-file
不同,您必须两次指定文件名.
Unlike kubectl create configmap --from-file
you do have to specify the filename twice.
这篇关于是否可以使用kubernetes_config_map资源--from-file ConfigMap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文