Deploy to a Google Kubernetes Engine cluster

Stay organized with collections Save and categorize content based on your preferences.

This document describes how to deploy your applications to Google Kubernetes Engine clusters.

Google Cloud Deploy allows you to deploy your container-based workloads to any Google Kubernetes Engine cluster. All Google Cloud Deploy features are supported when you deploy to GKE targets.

Before you begin

In this skaffold.yaml file, the deploy stanza includes kubectl, which indicates that Skaffold is rendering for, and deploying to, Kubernetes (GKE). And the manifests you use for this application are listed under there.

Create your target configuration

Each target can be configured in your delivery pipeline YAML, or can be in a separate file. Also, you can configure more than one target in the same file, but they must be in different kind: Target stanzas.

In the target definition, create a gke stanza to point to the GKE cluster:

The syntax for specifying a GKE cluster is as follows:

 cluster: projects/[project_name]/locations/[location]/clusters/[cluster_name]

This GKE resource identifier uses the following elements:

  • [project_name] is the name of the Google Cloud project in which you're running this cluster.

    The cluster you are deploying to does not need to be in the same project as your delivery pipeline.

  • [location] is the region in which the cluster was created.

  • [cluster_name] is the name given to the cluster when it was created.

    You can find this name in the list of clusters for your project, in the Google Cloud console.

    list of clusters in Google Cloud console

The following is an example target configuration, pointing to a GKE cluster:

      kind: Target
       name: dev
      description: development cluster
       cluster: projects/my-app/locations/us-central1/clusters/my-app-dev-cluster

Create your Skaffold configuration

This section provides and explains an example of a simple Skaffold configuration to use when deploying to a GKE cluster.

The following is an example skaffold.yaml file for deployment to a GKE cluster:

apiVersion: skaffold/v3alpha1
kind: Config
  name: gke-application
      - [MANIFEST]

Using Skaffold with Google Cloud Deploy describes in more detail how to use Skaffold with your delivery pipeline.

Prepare your Kubernetes manifests

To deploy your application to GKE, you provide Google Cloud Deploy with one or more Kubernetes manifests, which are rendered and then applied to the target cluster or clusters to deploy your application.

If you don't have those manifests, create them before you try to deploy using a Google Cloud Deploy delivery pipeline.

You can use Kustomize or Helm to help you create manifests. You can also use Kustomize or Helm if your manifests are templated and need to be rendered.

Putting it all together

Now that you have your Kubernetes manifests, your skaffold.yaml configuration, and your Google Cloud Deploy target definitions, and you've registered your targets as Google Cloud Deploy resources, you can now invoke your delivery pipeline to create a release and progress it through the progression of targets defined in the pipeline.

What's next