From 0a91f1598bb615f981284810dd5250ffe3598446 Mon Sep 17 00:00:00 2001 From: Marchenko Alexandr Date: Wed, 7 Feb 2018 09:27:45 +0200 Subject: [PATCH 1/3] connect to GCP GKE from local machine explanation of how to connect from lacal machine to Google Cloud Kubernetes without headache, close #91 --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index e214a5875..537fc0f28 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,21 @@ cd csharp\examples\simple dotnet run ``` +## Connecting to GCP GKE from local machine + +Start proxy to access kubernetes cluster: + +```bash +$ kubectl proxy +Starting to serve on 127.0.0.1:8001 +``` + +In code use following config: + +```csharp +var config = new KubernetesClientConfiguration { Host = "http://127.0.0.1:8001" }; +``` + ## Testing The project uses [XUnit](https://xunit.github.io) as unit testing framework. From 719585653ee7b0fef0783a9f15cf3b02cbc7e129 Mon Sep 17 00:00:00 2001 From: Marchenko Alexandr Date: Thu, 8 Feb 2018 08:59:00 +0200 Subject: [PATCH 2/3] connect to cluster from a local machine add preferred way of connecting to cluster, add alternative way with proxy for non supported auth providers --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 537fc0f28..8a9d8aff4 100644 --- a/README.md +++ b/README.md @@ -46,16 +46,23 @@ cd csharp\examples\simple dotnet run ``` -## Connecting to GCP GKE from local machine +## Connecting to a cluster from a local machine -Start proxy to access kubernetes cluster: +Preferred way of connecting to a cluster: + +``` +var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(); +var client = new Kubernetes(config); +``` + +Not all auth providers are supported at moment [#91](https://github.com/kubernetes-client/csharp/issues/91#issuecomment-362920478), but you still can connect to cluster by starting proxy: ```bash $ kubectl proxy Starting to serve on 127.0.0.1:8001 ``` -In code use following config: +and changing config: ```csharp var config = new KubernetesClientConfiguration { Host = "http://127.0.0.1:8001" }; From 19e9e0b32d1ea4ae72b6aaa6f56cf395933d47f0 Mon Sep 17 00:00:00 2001 From: Marchenko Alexandr Date: Thu, 8 Feb 2018 19:38:52 +0200 Subject: [PATCH 3/3] known issues and its workarounds --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8a9d8aff4..c04527721 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,9 @@ cd csharp\examples\simple dotnet run ``` -## Connecting to a cluster from a local machine +## Known issues -Preferred way of connecting to a cluster: +While preferred way of connecting to a remote cluster from local machine is: ``` var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(); @@ -68,6 +68,8 @@ and changing config: var config = new KubernetesClientConfiguration { Host = "http://127.0.0.1:8001" }; ``` +Notice that this is a workaround and is not recommended for production use + ## Testing The project uses [XUnit](https://xunit.github.io) as unit testing framework.