小编Xia*_* Li的帖子

当我编辑并保存 pod yaml 时,如何修复“map[] 不包含声明的合并键:名称”错误?

我正在尝试从私人注册表中提取图像。但 pod 的状态是“ImagePullBackOff”,这意味着我需要向 pod 添加一个 Secret。

Events:
  Type     Reason   Age                  From                                          Message
  ----     ------   ----                 ----                                          -------
  Normal   Pulling  52m (x255 over 22h)  kubelet, cn-huhehaote.i-hp3fkfzlcf1u9cigq2h7  pulling image "xxx/fcp"
  Normal   BackOff  8m (x5597 over 22h)  kubelet, cn-huhehaote.i-hp3fkfzlcf1u9cigq2h7  Back-off pulling image "xxx/fcp"
  Warning  Failed   3m (x5618 over 22h)  kubelet, cn-huhehaote.i-hp3fkfzlcf1u9cigq2h7  Error: ImagePullBackOff
Run Code Online (Sandbox Code Playgroud)

所以我在 pod yaml 中添加了以下代码。

spec:
      containers:
      - name: private-reg-container
        image: <your-private-image>
      imagePullSecrets:
      - name: my-secret
Run Code Online (Sandbox Code Playgroud)

然后我得到了

error: map: map[] does not contain declared merge key: name
Run Code Online (Sandbox Code Playgroud)

我找到的解决方案是删除“imagePullSecret”,这对我不起作用。我想知道如何修复该错误。谁能帮我?

kubectl 版本是

 kubectl …
Run Code Online (Sandbox Code Playgroud)

kubernetes kubernetes-pod kubernetes-secrets

8
推荐指数
2
解决办法
2万
查看次数