相关疑难解决方法(0)

Kubernetes 是否以 JSON 格式作为输入文件来创建 configmap 和 secret?

我有一个 JSON 格式的现有配置文件,如下所示

{
    "maxThreadCount": 10,
    "trackerConfigs": [{
            "url": "https://example1.com/",
            "username": "username",
            "password": "password",
            "defaultLimit": 1
        },
        {
            "url": "https://example2.com/",
            "username": "username",
            "password": "password",
            "defaultLimit": 1
        }
    ],
    "repoConfigs": [{
        "url": "https://github.com/",
        "username": "username",
        "password": "password",
        "type": "GITHUB"
    }],
    "streamConfigs": [{
        "url": "https://example.com/master.json",
        "type": "JSON"
    }]
}
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用 --from-file 选项传递键/值对属性文件,用于配置映射和秘密创建。

但是 JSON 格式的文件呢?Kubernetes 是否也将 JSON 格式文件作为输入文件来创建 configmap 和 secret?

$ kubectl create configmap demo-configmap --from-file=example.json
Run Code Online (Sandbox Code Playgroud)

如果我运行此命令,它会显示已创建 configmap/demo-configmap。但是如何在其他 pod 中引用此 configmap 值?

kubernetes kubernetes-pod kubernetes-secrets configmap

5
推荐指数
1
解决办法
1万
查看次数