---
title: "Kubernetes Cluster on Google Cloud"
description: "Deploy a managed Kubernetes cluster on Google Cloud with Pulumi and Google Kubernetes Engine (GKE) in TypeScript, Python, Go, C#, YAML, or HCL."
url: "https://www.pulumi.com/dev/templates/kubernetes/gcp/"
image: "https://www.pulumi.com/assets/og/dev/templates/kubernetes/gcp.png"
---

# Kubernetes Cluster on Google Cloud

Deploy a managed Kubernetes cluster on Google Cloud with Pulumi and Google Kubernetes Engine (GKE) in TypeScript, Python, Go, C#, YAML, or HCL.

The Google Cloud Kubernetes Cluster template scaffolds a Pulumi project that provisions a managed [Google Kubernetes Engine (GKE) cluster](https://www.pulumi.com/registry/packages/gcp/api-docs/container/cluster) and a [node pool](https://www.pulumi.com/registry/packages/gcp/api-docs/container/nodepool) inside a new [VPC network](https://www.pulumi.com/registry/packages/gcp/api-docs/compute/network) with a [subnet](https://www.pulumi.com/registry/packages/gcp/api-docs/compute/subnetwork). Worker nodes are deployed with private IP addresses for improved security.

![An architecture diagram of the Google Cloud Kubernetes Cluster template](./architecture.png)

## Using this template

To use this template to deploy your own Kubernetes cluster, make sure you've [installed Pulumi](https://www.pulumi.com/docs/install/) and [configured your Google Cloud credentials](https://www.pulumi.com/registry/packages/gcp/installation-configuration#credentials), then create a new [project](https://www.pulumi.com/docs/iac/concepts/projects/) using the template in the language of your choice:

**TypeScript**

```bash
mkdir my-k8s-cluster && cd my-k8s-cluster
pulumi new kubernetes-gcp-typescript
```

**Python**

```bash
mkdir my-k8s-cluster && cd my-k8s-cluster
pulumi new kubernetes-gcp-python
```

**Go**

```bash
mkdir my-k8s-cluster && cd my-k8s-cluster
pulumi new kubernetes-gcp-go
```

**C#**

```bash
mkdir my-k8s-cluster && cd my-k8s-cluster
pulumi new kubernetes-gcp-csharp
```

**YAML**

```bash
mkdir my-k8s-cluster && cd my-k8s-cluster
pulumi new kubernetes-gcp-yaml
```

**HCL**

```bash
mkdir my-k8s-cluster && cd my-k8s-cluster
pulumi new kubernetes-gcp-hcl
```

Follow the prompts to complete the new-project wizard. When it's done, you'll have a complete Pulumi project that's ready to deploy and configured with the most common settings. Feel free to inspect the code in `index.ts` for a closer look.

## Deploying the project

**TypeScript / Python / Go / C# / YAML**

You must supply an existing Google Cloud project ID to deploy the cluster. You can input it through the new-project wizard. Once the project is created, you can deploy it with [`pulumi up`](https://www.pulumi.com/docs/iac/cli/commands/pulumi_up):

**HCL**

The template deploys into your active Google Cloud project (read from your gcloud credentials) and defaults to the `us-central1` region, which you can change with the `region` setting. Once the new project is created, you can deploy it with [`pulumi up`](https://www.pulumi.com/docs/iac/cli/commands/pulumi_up):

```bash
$ pulumi up
```

When the deployment completes, Pulumi exports the following [stack output](https://www.pulumi.com/docs/iac/concepts/stacks/#outputs) values:

**TypeScript / Python / Go / C# / YAML**

**`networkName`**

The name of the VPC network containing the Kubernetes cluster resources.

**`networkId`**

The unique ID of the VPC network containing the Kubernetes cluster resources.

**`clusterName`**

The name of the GKE cluster.

**`clusterId`**

The unique ID of the GKE cluster.

**`kubeconfig`**

The cluster's kubeconfig file, which you can use with `kubectl` to access and communicate with your cluster.

**HCL**

**`network_name`**

The name of the VPC network containing the Kubernetes cluster resources.

**`cluster_name`**

The name of the GKE cluster.

**`kubeconfig`**

The cluster's kubeconfig file, which you can use with `kubectl` to access and communicate with your cluster.

Output values like these are useful in many ways, most commonly as inputs for other stacks or related cloud resources.

## Customizing the project

Projects created with the Kubernetes Cluster template expose the following [configuration](https://www.pulumi.com/docs/iac/concepts/config/) settings:

**TypeScript / Python / Go / C# / YAML**

**`gcp:project`**

The Google Cloud project ID to deploy into.

**`gcp:region`**

The Google Cloud region to deploy into. Defaults to `us-central1`.

**`nodesPerZone`**

The desired number of nodes per zone in the node pool. Defaults to `1`.

**HCL**

**`region`**

The Google Cloud region to deploy into. Defaults to `us-central1`.

**`nodes_per_zone`**

The desired number of nodes per zone in the node pool. Defaults to `1`.

All of these settings are optional and may be adjusted either by editing the stack configuration file directly (by default, `Pulumi.dev.yaml`) or by changing their values with [`pulumi config set`](https://www.pulumi.com/docs/iac/cli/commands/pulumi_config_set):

**TypeScript / Python / Go / C# / YAML**

```bash
$ pulumi config set nodesPerZone 2
$ pulumi up
```

**HCL**

```bash
$ pulumi config set nodes_per_zone 2
$ pulumi up
```

## Cleaning up

You can cleanly destroy the stack and all of its infrastructure with [`pulumi destroy`](https://www.pulumi.com/docs/iac/cli/commands/pulumi_destroy):

```bash
$ pulumi destroy
```

## Learn more

- Browse other architecture templates in the [Templates gallery](https://www.pulumi.com/templates).
- Explore the [Google Cloud provider API docs](https://www.pulumi.com/registry/packages/gcp) in the Pulumi Registry.
- Walk through Pulumi from the ground up in [Pulumi Tutorials](https://www.pulumi.com/dev/browse/?type=tutorial).
- Read the latest [Google Cloud posts on the Pulumi blog](https://www.pulumi.com/blog/tag/google-cloud).
