Note:
This documentation is for version 2.4.0 of the library.
Some samples may not work with other versions.
Installation
Install the Google.Cloud.Container.V1 package from NuGet. Add it to
your project in the normal way (for example by right-clicking on the
project in Visual Studio and choosing "Manage NuGet Packages...").
Authentication
When running on Google Cloud Platform, no action needs to be taken to authenticate.
Otherwise, the simplest way of authenticating your API calls is to
download a service account JSON file then set the GOOGLE_APPLICATION_CREDENTIALS environment variable to refer to it.
The credentials will automatically be used to authenticate. See the Getting Started With
Authentication guide for more details.
ClusterManagerClient client = ClusterManagerClient.Create();
// You can list clusters in a single zone, or specify "-" for all zones.
LocationName location = new LocationName(projectId, locationId: "-");
ListClustersResponse zones = client.ListClusters(location.ToString());
foreach (Cluster cluster in zones.Clusters)
{
Console.WriteLine($"Cluster {cluster.Name} in {cluster.Location}");
}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-21 UTC."],[[["The `Google.Cloud.Container.V1` library is a .NET client for the Google Kubernetes Engine API, with version 3.33.0 being the latest release."],["This webpage's documentation specifically covers version 2.4.0 of the `Google.Cloud.Container.V1` .NET library, which may not be compatible with samples for other versions."],["Authentication for the API calls is automatic when running on Google Cloud Platform, otherwise you can download a service account JSON file and use it through the `GOOGLE_APPLICATION_CREDENTIALS` environment variable."],["The primary interface for interacting with the API is the `ClusterManagerClient`, as shown in the provided code sample that lists clusters."],["There is a link for each of the versions from 2.3.0 to 3.33.0 and the latest version, linking to the specific version's documentation."]]],[]]