我想使用Terraform部署Metallb。 metallb配置如下。
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配置?
最佳答案
您可以使用file() interpolation function读取文件内容。可能看起来像:
resource "kubernetes_config_map" "config" {
metadata {
namespace = "metallb_system"
name = "config"
}
data {
config = "${file(${path.module}/config.yml)}"
}
}
与
kubectl create configmap --from-file
不同,您必须两次指定文件名。
关于kubernetes - 是否可以使用kubernetes_config_map资源--from-file ConfigMap?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53667413/