client-go

How to Submit generic “runtime.Object” to Kubernetes API using client-go

折月煮酒 提交于 2021-02-18 05:13:41
问题 I'm using AWS' EKS which is Kubernetes v1.10 and I'm using client-go v7.0.0. What I'm trying to do is parse a .yml file with multiple Kubernetes resource definitions in a file and submit those resources to the Kubernetes API. I can successfully parse the files using this code scheme.Codecs.UniversalDeserializer().Decode , and I get back an array of runtime.Object . I know that all the Kubernetes resources conform to the runtime.Object interface, but I can't find a way to submit the generic

How to Submit generic “runtime.Object” to Kubernetes API using client-go

一个人想着一个人 提交于 2021-02-18 05:04:31
问题 I'm using AWS' EKS which is Kubernetes v1.10 and I'm using client-go v7.0.0. What I'm trying to do is parse a .yml file with multiple Kubernetes resource definitions in a file and submit those resources to the Kubernetes API. I can successfully parse the files using this code scheme.Codecs.UniversalDeserializer().Decode , and I get back an array of runtime.Object . I know that all the Kubernetes resources conform to the runtime.Object interface, but I can't find a way to submit the generic

Issue using in-cluster kubernetes configuration with client-go library on google cloud build

扶醉桌前 提交于 2021-02-10 12:23:08
问题 I'm having a bit of a challenge try to build my app which is using the golang client-go library. What the app does is provide and api which then deploys a pod to a kubernetes cluster. Now the app is able to deploy a pod successfully if I use an out of cluster kubernetes(i.e minikube) config which is found in $HOME/.kube/config. See code below that determines which config to use depending on the config path; package kubernetesinterface import ( "log" "os" core "k8s.io/api/core/v1" v1 "k8s.io

In Cluster Config is unable to get pods when deployed in a non-default namespace

北慕城南 提交于 2021-01-29 06:11:53
问题 When I deploy my golang service to any namespace but the default namespace, the service is unable to retrieve pods on any namespace. The same service deployed on the default namespace works perfectly, using the golang client-go api. Is this a security issue? Thanks. 回答1: This issue is permission issue. Since you are using rest.InClusterConfig(config) to create client. That means it using pod's service account as credential. So check whether that service account has the permission to get pods