[英]Error while exec kubectl get po -o yaml in golang example
How to get Kubectl get po -o yaml in golang如何在 golang 中获取 Kubectl get po -o yaml
it to run this code Go client example它运行此代码Go 客户端示例
where the expected output is预期输出在哪里
./app
There are 3 pods in the cluster
There are 3 pods in the cluster
There are 3 pods in the cluster
but when i run it i got但是当我运行它时,我得到了
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
这可能是由于您的 k8s 客户端/服务器版本高于 1.24+ https://github.com/aws/aws-cli/issues/6920请参阅此以获得进一步说明
the following steps fixed the issue以下步骤解决了该问题
$ cd client-go/examples/out-of-cluster-client-configuration
$ go mod init example.com/m
$ go mod tidy
$ go build -o app .
$ ./app
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.