---
title: "Deploy to Google Cloud Platform"
description: "This document provides examples of deploying to Google Cloud Platform."
platform: "Cloud, Server"
doc_version: "Server"
last_updated: "2026-10-06"
---

> For current CircleCI product defaults, deprecated patterns, and Cloud/Server differences, see [AGENTS.md](https://circleci.com/docs/AGENTS.md).
>
> For the complete documentation index and site structure, see [llms.txt](https://circleci.com/docs/llms.txt).

# Deploy to Google Cloud Platform

In this how-to guide, you will learn how to configure CircleCI to deploy to Google Cloud Platform.

## Introduction

Before deploying to Google Cloud Platform, you will need to authorize the Google Cloud SDK and set default configuration settings. Refer to the [Authorizing the Google Cloud SDK](https://circleci.com/docs/guides/server/integration/authorize-google-cloud-sdk/) page for full details.

In addition to the orbs described below, CircleCI has created a GCP convenience image focusing on [deployment: `cimg/gcp`](https://circleci.com/developer/images/image/cimg/gcp).

## Using Google Cloud orbs

Several Google Cloud orbs are available in the [CircleCI Orbs Registry](https://circleci.com/developer/orbs). Use the orbs to simplify your deployments. For example, the [Google Kubernetes Engine (GKE) orb](https://circleci.com/developer/orbs/orb/circleci/gcp-gke#usage-publish-and-rollout-image) has a pre-built job to build and publish a Docker image, and roll the image out to a GKE cluster:

Make sure to replace any placeholder versions in the example.

```yaml
version: 2.1

orbs:
  gke: circleci/gcp-gke@x.y.z # Use the GCP GKE orb in your config

workflows:
  main:
    jobs:
      - gke/publish-and-rollout-image:
          cluster: <your-GKE-cluster> # name of GKE cluster to be created
          container: <your-K8-container-name> # name of your Kubernetes container
          deployment: <your-K8-deployment-name> # name of your Kubernetes deployment
          image: <your-image> # name of your Docker image
          tag: $CIRCLE_SHA1 # Docker image tag - optional
```

## Deployment to GKE without orbs

In the following example, if the `build-job` passes and the current branch is `main`, CircleCI runs the deployment job.

```yml
version: 2.1

jobs:
  # build job omitted for brevity
  deploy-job:
    docker:
      - image: <docker-image-name-tag>
    working_directory: /tmp/my-project
    steps:
      - run:
          name: Deploy Main to GKE
          command: |
            # Push Docker image to registry, update K8s deployment to use new image - `gcloud` command handles authentication and push all at once
            sudo /opt/google-cloud-sdk/bin/gcloud docker push us.gcr.io/${PROJECT_NAME}/hello
            # The new image is now available in GCR for the GCP infrastructure to access, next, change permissions:
            sudo chown -R ubuntu:ubuntu /home/ubuntu/.kube
            # Use `kubectl` to find the line that specifies the image to use for our container, replace with image tag of the new image.
            # The K8s deployment intelligently upgrades the cluster by shutting down old containers and starting up-to-date ones.
            kubectl patch deployment docker-hello-google -p '{"spec":{"template":{"spec":{"containers":[{"name":"docker-hello-google","image":"us.gcr.io/circle-ctl-test/hello:'"$CIRCLE_SHA1"'"}]}}}}'

workflows:
  build-deploy:
    jobs:
      - build-job
      - deploy-job:
          requires:
            - build-job # Only deploy once the build job has completed
          filters: pipeline.git.branch == "main" # only run the deploy-job job on the main branch
```

For another example, see our [CircleCI Google Cloud deployment example project](https://github.com/CircleCI-Public/circleci-demo-k8s-gcp-hello-app).