如何修复'map []在编辑和保存pod yaml时不包含声明的合并键:name'错误?

问题描述 投票:3回答:1

我正试图从私人注册表中提取图像。但pod的状态是'ImagePullBackOff',这意味着我需要为pod添加一个秘密。

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

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

spec:
      containers:
      - name: private-reg-container
        image: <your-private-image>
      imagePullSecrets:
      - name: my-secret

然后我得到了

error: map: map[] does not contain declared merge key: name

我搜索出的解决方案是删除'imagePullSecret',这对我不起作用。我想知道如何修复错误。谁能帮我?

kubectl版本是

 kubectl version
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.5", GitCommit:"753b2dbc622f5cc417845f0ff8a77f539a4213ea", GitTreeState:"clean", BuildDate:"2018-11-26T14:41:50Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.5", GitCommit:"753b2dbc622f5cc417845f0ff8a77f539a4213ea", GitTreeState:"clean", BuildDate:"2018-11-26T14:31:35Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

kubernetes kubernetes-pod kubernetes-secrets
1个回答
1
投票

正如@fiunchinho在评论中提到的并且根据Federation with Kubefed - 不推荐使用集群联合。

强烈建议不要使用Federation v1。联盟V1从未达到过GA状态,不再处于积极发展状态。文档仅用于历史目的。

解决方案是使用Kubernetes Federation v2。有关更多详细信息,请参阅Federation v2 user guideFederation v development guide

© www.soinside.com 2019 - 2024. All rights reserved.