首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在golang示例中执行kubectl获取po -o yaml时出错

在golang示例中执行kubectl获取po -o yaml时出错
EN

Stack Overflow用户
提问于 2022-05-31 09:24:26
回答 2查看 807关注 0票数 0

如何在高浪县获得Kubectl得到po -o yaml

运行此代码Go客户端示例

其中预期的输出是

代码语言:javascript
复制
./app
There are 3 pods in the cluster
There are 3 pods in the cluster
There are 3 pods in the cluster

但是当我运行它的时候

代码语言:javascript
复制
 go build -o app .
    ./app
panic: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

goroutine 1 [running]:
main.main()
    /Users/padmanabanpr/Documents/client-go/examples/out-of-cluster-client-configuration/main.go:61 +0x5b6
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-05-31 09:35:16

这可能是由于您的k8s客户机/服务器版本高于1.24+ https://github.com/aws/aws-cli/issues/6920,请参阅此以进一步澄清。

票数 1
EN

Stack Overflow用户

发布于 2022-06-01 04:52:40

以下步骤解决了这个问题

  • 安装Kubectl客户端1.23.0-00(1.24.x有一些问题)
代码语言:javascript
复制
$ cd client-go/examples/out-of-cluster-client-configuration
$ go mod init example.com/m
$ go mod tidy
$ go build -o app .
$ ./app
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72445271

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档