如何在 golang 中獲取 Kubectl get po -o yaml
它運行此代碼 Go 客戶端示例
預期輸出在哪里
./app
There are 3 pods in the cluster
There are 3 pods in the cluster
There are 3 pods in the cluster
但是當我運行它時,我得到了
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
uj5u.com熱心網友回復:
這可能是由于您的 k8s 客戶端/服務器版本高于 1.24 https://github.com/aws/aws-cli/issues/6920請參閱此以獲得進一步說明
uj5u.com熱心網友回復:
以下步驟解決了該問題
- 安裝 Kubectl 客戶端 1.23.0-00(1.24.x 有問題)
$ cd client-go/examples/out-of-cluster-client-configuration
$ go mod init example.com/m
$ go mod tidy
$ go build -o app .
$ ./app
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/485176.html
標籤:去 Kubernetes 客户端去
