I'm stuck at creating a user
for my serivice_account
which I can use in my kubeconfig
Background: I have a cluser-A, which I have created using the google-cloud-python library. I can see the cluster created in the console. Now I want to deploy some manifests to this cluster so i'm trying to use the kubernetes-python client. To create a Client()
object, I need to have a KUBECONFIG so I can:
client = kubernetes.client.load_kube_config(<MY_KUBE_CONFIG>)
I'm stuck at generating a user
for this service_account in my kubeconfig. I don't know what kind of authentication certificate/key I should use for my user.
Searched everywhere but still can't figure out how to use my service_account to access my GKE cluster through the kubernetes-python library.
Additional Info: I already have a Credentials()
object (source) created using the service_accounts.Credentails()
class (source).
A Kubernetes ServiceAccount is generally used by a service within the cluster itself, and most clients offer a version of rest.InClusterConfig()
. If you mean a GCP-level service account, it is activated as below:
gcloud auth activate-service-account --key-file gcp-key.json
and then probably you would set a project and use gcloud container clusters get-credentials
as per normal with GKE to get Kubernetes config and credentials.