小编vic*_*tha的帖子

用于Go的Kubernetes客户端-只能将错误编码的映射图或数组解码为结构

我正在尝试使用Kubernetes Client for Go更新Openshift中的现有部署。我正在使用以下JSON将副本更新为3:

JSON:

{
  "kind": "Deployment",
  "spec": {
    "template": {
      "spec": {
        "containers": {
          "image": "docker.fmr.com\/fmr-pr000105\/testcontainer:1.0.0",
          "name": "testcontainer",
          "resources": {
            "requests": {
              "cpu": "50m"
            },
            "limits": {
              "cpu": "50m",
              "memory": "50M"
            }
          },
          "ports": {
            "protocol": "TCP",
            "name": "test-con-http",
            "containerPort": 22
          }
        }
      },
      "metadata": {
        "labels": {
          "app": "testcontainer"
        }
      }
    },
    "replicas": 3
  },
  "apiVersion": "extensions\/v1beta1",
  "metadata": {
    "name": "testcontainer"
  }
}
Run Code Online (Sandbox Code Playgroud)

但是继续得到错误:

only encoded map or array can be decoded into a struct
Run Code Online (Sandbox Code Playgroud)

我正在使用以下代码:

import …
Run Code Online (Sandbox Code Playgroud)

go kubernetes kubernetes-go-client

3
推荐指数
1
解决办法
1537
查看次数

标签 统计

go ×1

kubernetes ×1

kubernetes-go-client ×1