-
Notifications
You must be signed in to change notification settings - Fork 299
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
connect to GCP GKE from local machine #92
Conversation
explanation of how to connect from lacal machine to Google Cloud Kubernetes without headache, close kubernetes-client#91
Hm, I have signed PR, should I do something next with it? or it will mark as ok in a while? |
just wait for review |
README.md
Outdated
@@ -46,6 +46,21 @@ cd csharp\examples\simple | |||
dotnet run | |||
``` | |||
|
|||
## Connecting to GCP GKE from local machine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These instructions are generic to any cloud provider, so it likely should be:
Connecting to a cluster from a local machine
or somesuch.
README.md
Outdated
Start proxy to access kubernetes cluster: | ||
|
||
```bash | ||
$ kubectl proxy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think connecting through the proxy is the preferred way to sugest that people connect.
README.md
Outdated
In code use following config: | ||
|
||
```csharp | ||
var config = new KubernetesClientConfiguration { Host = "http://127.0.0.1:8001" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The preferred way to connect is to use the config file on disk as follows:
var k8SClientConfig = KubernetesClientConfiguration.BuildConfigFromConfigFile();
IKubernetes client = new Kubernetes(k8SClientConfig);
https://github.com/kubernetes-client/csharp/blob/master/examples/namespace/Namespace.cs#L52
Thanks for the PR. I made some comments. Can you adapt the example to use the preferred way of connecting to a cluster: var k8SClientConfig = KubernetesClientConfiguration.BuildConfigFromConfigFile();
IKubernetes client = new Kubernetes(k8SClientConfig); Then I think we can merge it in. Thanks! |
add preferred way of connecting to cluster, add alternative way with proxy for non supported auth providers
I do agree with your point about As about preferred way - yep it definitely should be like you have written, but unfortunately it will not always work - this PR is all about work around so people can still play with K8S api without headache So I have changed description to "here is how you should do it normally and here is workaround" Thank you in advance |
Can you explain the situations where it won't work? If 'kubectl' works then you have a valid kubeconfig. The c# library should pick that up and connect.
If there is a kubeconfig that doesn't work, please file a bug with an example config, that's something we should fix.
I don't want people to rely on proxy to use this client library
Thanks!
--brendan
…________________________________
From: Marchenko Alexandr <[email protected]>
Sent: Wednesday, February 7, 2018 11:03:48 PM
To: kubernetes-client/csharp
Cc: Brendan Burns; Comment
Subject: Re: [kubernetes-client/csharp] connect to GCP GKE from local machine (#92)
I do agree with your point about Connecting to a cluster from a local machine reason why I called it like so is just because GKE is only one cloud provider who has stable K8S not in preview, but it gonna change fast so you are right
As about preferred way - yep it definitely should be like you have written, but unfortunately it will not always work - this PR is all about work around so people can still play with K8S api without headache
So I have changed description to "here is how you should do it normally and here is workaround"
Thank you in advance
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkubernetes-client%2Fcsharp%2Fpull%2F92%23issuecomment-364020974&data=04%7C01%7Cbburns%40microsoft.com%7C3982c9e56f6d4e824b8808d56ec21a6e%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C0%7C636536702303359693%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=5x9v74IvFSZ1SiupkFA8vSXvd4RXnnh7OvXf6GHMwrI%3D&reserved=0>, or mute the thread<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFfDgoDFoxPf0-IG97HpKJMQYWmN2J6gks5tSpxUgaJpZM4R8QX8&data=04%7C01%7Cbburns%40microsoft.com%7C3982c9e56f6d4e824b8808d56ec21a6e%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C0%7C636536702303359693%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=9v0mUjR%2BMCgYZXYroo0U6sTQLTzG4zMxU4uUe7mKbos%3D&reserved=0>.
|
Yep, it was first thing I did, here it is: #91 (comment) I totally agree with your point, especially for something running in production, but it is a alternative for a temporary playground, e.g. in my case simple hello world application |
LGTM, many thanks for the patience. |
explanation of how to connect from lacal machine to Google Cloud Kubernetes without headache, close #91