gpt4 book ai didi

Kubernetes 容器环境

转载 作者:行者123 更新时间:2023-12-02 11:34:16 24 4
gpt4 key购买 nike

我在 k8s 中写了 deployment.yml 文件:-

spec:
containers:
- name: consul
image: xyz
ports:
- name: http
containerPort: 8500
- name: http1
containerPort: 53
env:
- name: SERVICE_8500_IGNORE
value: "true"
- name: CONSUL_LOCAL_CONFIG
value: "{"node_name": "docker","acl_datacenter": "dc1", "acl_default_policy": "deny", "acl_down_policy": "deny", "acl_master_token": "fleeture", "acl_agent_token":"xyz", "enable_script_checks": true}"

运行后报错

Error : Unexpected characters near "node_name": "docker","acl_datacenter": "dc1", "acl_default_policy": "deny", "acl_down_policy": "deny", "acl_master_token": "xyz", "acl_agent_token":"xyz", "enable_script_checks": true}"". Line : 14 value: "{"node_name": "docker","acl_datacenter": "dc1", "acl_default_policy": "deny", "acl_down_policy": "deny", "acl_master_token": "fleeture", "acl_agent_token":"xyz", "enable_script_checks": true}"

知道如何为第 14 行编写 ENV 吗?

最佳答案

您需要使用 \ 转义 CONSUL_LOCAL_CONFIG 值中的双引号,以便条目变为:

- name: CONSUL_LOCAL_CONFIG
value: "{\"node_name\": \"docker\",\"acl_datacenter\": \"dc1\", \"acl_default_policy\": \"deny\", \"acl_down_policy\": \"deny\", \"acl_master_token\": \"fleeture\", \"acl_agent_token\":\"xyz\", \"enable_script_checks\": true}"

关于Kubernetes 容器环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53728219/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com