假设我有一个模块,它会生成一些 ids: module.tf:
resource "random_id" "etcdapiserver-id" {
byte_length = 4
count = "${var.etcd_apiserver_count}"
}
Run Code Online (Sandbox Code Playgroud)
模块_输出.tf:
output "etcdapiserver_hostname_list" {
value = ["${random_id.etcdapiserver-id.*.hex}"]
}
Run Code Online (Sandbox Code Playgroud)
它似乎工作正常,列表成功地在输出中结束:
terraform output --module=module
etcdapiserver_hostname_list = [
751adf6a,
9e573ee7,
edb94de3
]
Run Code Online (Sandbox Code Playgroud)
现在我想在主 terraform 配置中使用此列表中的元素。假设我正在 openstack 上创建多个计算实例: main.tf:
resource "openstack_compute_instance_v2" "etcdapiserver" {
count = "3"
name = "etcdapi-node-${element(module.ignition.etcdapiserver_hostname_list.*, count.index)}"
Run Code Online (Sandbox Code Playgroud)
但它会失败
错误:资源“openstack_compute_instance_v2.etcdapiserver”配置:“etcdapiserver_hostname_list.*”不是模块“ignition”的有效输出
有什么办法可以做到吗?谢谢!
GKE 上运行的 ElasticSearch 集群出现问题。具有“数据”角色的节点开始意外崩溃并出现错误:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
bootstrap checks failed
Run Code Online (Sandbox Code Playgroud)
当然,这个 StatefulSet 控制器中有一个 init 容器,它将 vm.max_map_count 设置为 262144
更重要的是,这个初始化容器似乎成功完成:
kubectl descrive pod elastic-data-0
Init Containers:
init-sysctl:
Container ID: docker://23d3b3d11198510aa01aef340b92e1603785804fbf75e963fdbd61acfe458318
Image: busybox:latest
Image ID: docker-pullable://busybox@sha256:5e8e0509e829bb8f990249135a36e81a3ecbe94294e7a185cc14616e5fad96bd
Port: <none>
Command:
sysctl
-w
vm.max_map_count=262144
State: Terminated
Reason: Completed
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: elastic-data
labels:
component: elasticsearch
role: data
spec:
serviceName: elasticsearch-data
updateStrategy:
type: RollingUpdate
replicas: 3
template:
metadata:
labels:
component: elasticsearch …
Run Code Online (Sandbox Code Playgroud)