Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

GKE authentication #65

Closed
brosner opened this issue Aug 29, 2016 · 5 comments
Closed

GKE authentication #65

brosner opened this issue Aug 29, 2016 · 5 comments

Comments

@brosner
Copy link
Contributor

brosner commented Aug 29, 2016

pykube is not capable of authenticating against GKE clusters. Recent clusters on GKE use Google OAuth to authenticate. The user configuration in ~/.kube/config looks like:

user:
  auth-provider:
    name: gcp

Once kubectl runs with that configuration it adds in the config key with an access-token and expiry.

In my initial research, I learned that oauth2client uses httplib which is a non-starter for integrating it with pykube. However, there's hope with googleapis/oauth2client#128

@paultiplady
Copy link
Contributor

I knocked together a quick fix for this -- WDYT about this approach?

It leaves auth to the gcloud tool, which I think is probably fine.

@paultiplady
Copy link
Contributor

More specifically, the auth/re-auth is handled by the command gcloud container clusters get-credentials CLUSTER_NAME

@brosner
Copy link
Contributor Author

brosner commented Sep 8, 2016

I am in favor of your approach in the PR. I commented there too. I am going to leave this open to track the feature of implementing the authentication ourself (at some point), but your change at least enables pykube to use auth-provider if present with a token.

@nshttpd
Copy link
Contributor

nshttpd commented Sep 12, 2016

So I just ran into this problem with a 1.3.x GKE cluster where my .kube/config only had the gcp auth-provider info. I got it working by creating a ServiceAccount and then using the Token that was created in the Secret associated with the ServiceAccount in the .kube/config for my deployment tool that uses PyKube. Works like a champ.

@victorgp
Copy link
Contributor

Having the auth-provider token in kubeconfig is not enough because it expires and pykube doesn't refresh it, as opposite as kubectl that does it. I've created this #76 to address the issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants