Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No access token in .kube/config

After upgrading my cluster in GKE the dashboard will no longer accept certificate authentication.

No problem there's a token available in the .kube/config says my colleague

  user:
    auth-provider:
      config:
        access-token: REDACTED
        cmd-args: config config-helper --format=json
        cmd-path: /home/user/workspace/google-cloud-sdk/bin/gcloud
        expiry: 2018-01-09T08:59:18Z
        expiry-key: '{.credential.token_expiry}'
        token-key: '{.credential.access_token}'
      name: gcp

Except in my case there isn't...

  user:
    auth-provider:
      config:
        cmd-args: config config-helper --format=json
        cmd-path: /home/user/Dev/google-cloud-sdk/bin/gcloud
        expiry-key: '{.credential.token_expiry}'
        token-key: '{.credential.access_token}'
      name: gcp

I've tried re-authenticating with gcloud, comparing gcloud settings with colleagues, updating gcloud, re-installing gcloud, checking permissions in Cloud Platform. Pretty much everything I can think of, by still no access token will be generated.

Can anyone help please?!

 $ gcloud container clusters get-credentials cluster-3 --zone xxx --project xxx                            
Fetching cluster endpoint and auth data.
kubeconfig entry generated for cluster-3.

$ gcloud config list                                                                                                    
[core]
account = xxx
disable_usage_reporting = False
project = xxx

Your active configuration is: [default]

$ kubectl version                                                                                                                    
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4"
like image 679
MarkNS Avatar asked Jan 09 '18 09:01

MarkNS


1 Answers

Ok, very annoying and silly answer - you have to make any request using kubectl for the token to be generated and saved into the kubeconfig file.

like image 55
MarkNS Avatar answered Sep 22 '22 21:09

MarkNS