1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| apiVersion: v1 kind: ConfigMap metadata: name: consul-config namespace: demo data: server.json: | { "bind_addr": "0.0.0.0", // 应为内部集群通信绑定的地址 "client_addr": "0.0.0.0", // consul绑定客户端接口的地址 "disable_host_node_id": true, // 将此设置为true将阻止Consul使用来自主机的信息生成确定性节点标识,并将生成随机节点标识,该标识将保留在数据目录中 "data_dir": "/consul/data", // consul持久化数据存储位置 "datacenter": "shisuyun", // 数据中心名称 "bootstrap_expect": 3, // 组成集群预期需要的数量 "server": true, // 表示当前使用的server模式 "domain": "cluster.consul", // 默认情况下,Consul响应"consul"中的DNS查询 "retry_join": [ // k8s集群 "provider=k8s namespace=demo label_selector=\"app=consul,component=server\"" ], "telemetry": { "prometheus_retention_time": "5m" } } ui.json: | { "ui" : true, // 启用内置的Web UI服务器和所需的HTTP路由 "client_addr" : "0.0.0.0", "enable_script_checks" : false, "disable_remote_exec" : true }
|