Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildConfigFromConfigFile explanation missing #91

Closed
mac2000 opened this issue Feb 4, 2018 · 9 comments · Fixed by #92
Closed

BuildConfigFromConfigFile explanation missing #91

mac2000 opened this issue Feb 4, 2018 · 9 comments · Fixed by #92

Comments

@mac2000
Copy link
Contributor

mac2000 commented Feb 4, 2018

Hello, I'm trying to run code copied from examples but got Unhandled Exception: k8s.Exceptions.KubeConfigException: User: X does not have appropriate auth credentials in kubeconfig

Can not find instructions in readme how should we run code locally agains google cloud kubernetes

I do have ~/.kube and commands like kubectl get pods are working as expected

@tg123
Copy link
Member

tg123 commented Feb 4, 2018

#24
cloud you please paste your config for debug?

the sdk should have same behavior as kubectl

@mac2000
Copy link
Contributor Author

mac2000 commented Feb 4, 2018

do you mean .kube/config here you go:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: ****************************=
    server: https://X.X.X.X
  name: gke_project_id_europe-west1-b_cluster
contexts:
- context:
    cluster: gke_project_id_europe-west1-b_cluster
    user: gke_project_id_europe-west1-b_cluster
  name: gke_project_id_europe-west1-b_cluster
current-context: gke_project_id_europe-west1-b_cluster
kind: Config
preferences: {}
users:
- name: gke_project_id_europe-west1-b_cluster
  user:
    auth-provider:
      config:
        access-token: ******************************
        cmd-args: config config-helper --format=json
        cmd-path: /Users/mac/dev/google-cloud-sdk/bin/gcloud
        expiry: 2018-02-04T12:51:26Z
        expiry-key: '{.credential.token_expiry}'
        token-key: '{.credential.access_token}'
      name: gcp

I just replaced some thing that might be important, hope that helps. Feel free to ask me for any additional information if needed

@tg123
Copy link
Member

tg123 commented Feb 4, 2018

auth-provider is not supported at the time.

😢

@tg123
Copy link
Member

tg123 commented Feb 4, 2018

by the way
you may want try a workaround:
pass Token filed to sdk

@mac2000
Copy link
Contributor Author

mac2000 commented Feb 4, 2018

@tg123 may you please describe it it more details? it seems like it might be a good addition to readme

@tg123
Copy link
Member

tg123 commented Feb 4, 2018

@mac2000 did not tested

get token from https://cloud.google.com/docs/authentication/production#obtaining_credentials_on_compute_engine_kubernetes_engine_app_engine_flexible_environment_and_cloud_functions first

create a client from KubernetesClientConfiguration { Host = gke_cluster , AccessToken = token above }

@mac2000
Copy link
Contributor Author

mac2000 commented Feb 5, 2018

Arghhh, it was painful

So from docs I we able to get default access token, so even do not need any google auth stuff

But then got macos related troubles with ssl verification

And only then I have realized what it should be done, so if you are running kubernetes inside google cloud and just wish to play around with api and wish not to configure everything all you should do:

$ kubectl proxy
Starting to serve on 127.0.0.1:8001

And in your program:

var config = new KubernetesClientConfiguration {  Host = "http://127.0.0.1:8001" };

And everything will start working immediately :)

Not sure if it should be mentioned somewhere in readme or not

mac2000 added a commit to mac2000/csharp that referenced this issue Feb 7, 2018
explanation of how to connect from lacal machine to Google Cloud Kubernetes without headache, close kubernetes-client#91
brendandburns pushed a commit that referenced this issue Feb 13, 2018
* connect to GCP GKE from local machine

explanation of how to connect from lacal machine to Google Cloud Kubernetes without headache, close #91

* connect to cluster from a local machine

add preferred way of connecting to cluster, add alternative way with proxy for non supported auth providers

* known issues and its workarounds
@samuela
Copy link

samuela commented Oct 13, 2018

What's the production-ready approach here? Using kubectl proxy seems fine for development but the README indicates that it's not appropriate for production.

@brendandburns
Copy link
Contributor

@samuela someone needs to write support for GCP for this library.

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

Successfully merging a pull request may close this issue.

4 participants