Skip to content

connect to GCP GKE from local machine#92

Merged
brendandburns merged 3 commits intokubernetes-client:masterfrom
marchenko1985:patch-1
Feb 13, 2018
Merged

connect to GCP GKE from local machine#92
brendandburns merged 3 commits intokubernetes-client:masterfrom
marchenko1985:patch-1

Conversation

@marchenko1985
Copy link
Copy Markdown
Contributor

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

explanation of how to connect from lacal machine to Google Cloud Kubernetes without headache, close kubernetes-client#91
@marchenko1985
Copy link
Copy Markdown
Contributor Author

Hm, I have signed PR, should I do something next with it? or it will mark as ok in a while?

@tg123
Copy link
Copy Markdown
Member

tg123 commented Feb 7, 2018

you can try push -f to force it rerun on your side. project admin may retrigger it too.

just wait for review

Comment thread README.md Outdated
dotnet run
```

## Connecting to GCP GKE from local machine
Copy link
Copy Markdown
Contributor

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.

Comment thread README.md
Start proxy to access kubernetes cluster:

```bash
$ kubectl proxy
Copy link
Copy Markdown
Contributor

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.

Comment thread README.md
In code use following config:

```csharp
var config = new KubernetesClientConfiguration { Host = "http://127.0.0.1:8001" };
Copy link
Copy Markdown
Contributor

@brendandburns brendandburns Feb 8, 2018

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

@brendandburns
Copy link
Copy Markdown
Contributor

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
@marchenko1985
Copy link
Copy Markdown
Contributor Author

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

@brendandburns
Copy link
Copy Markdown
Contributor

brendandburns commented Feb 8, 2018 via email

@marchenko1985
Copy link
Copy Markdown
Contributor Author

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

@brendandburns
Copy link
Copy Markdown
Contributor

brendandburns commented Feb 8, 2018 via email

@brendandburns
Copy link
Copy Markdown
Contributor

LGTM, many thanks for the patience.

@brendandburns brendandburns merged commit 4f80289 into kubernetes-client:master Feb 13, 2018
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 this pull request may close these issues.

BuildConfigFromConfigFile explanation missing

3 participants