Files
csharp/README.md
Marchenko Alexandr 4f80289b81 connect to GCP GKE from local machine (#92)
* 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
2018-02-13 06:43:35 -08:00

2.0 KiB

Kubernetes C# Client

Travis Client Capabilities Client Support Level

Usage

Nuget Package

dotnet add package KubernetesClient

Generating the Client Code

Prerequisites

Check out the generator project into some other directory (henceforth $GEN_DIR)

cd $GEN_DIR/..
git clone https://github.com/kubernetes-client/gen

Install the autorest tool:

npm install autorest

Generating code

# Where REPO_DIR points to the root of the csharp repository
cd ${REPO_DIR}/csharp/src
${GEN_DIR}/openapi/csharp.sh generated csharp.settings

Usage

Running the Examples

git clone git@github.com:kubernetes-client/csharp.git
cd csharp\examples\simple
dotnet run

Known issues

While preferred way of connecting to a remote cluster from local machine is:

var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
var client = new Kubernetes(config);

Not all auth providers are supported at moment #91, but you still can connect to cluster by starting proxy:

$ kubectl proxy
Starting to serve on 127.0.0.1:8001

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 as unit testing framework.

To run the tests

cd csharp\tests
dotnet restore
dotnet test