Skip to main content
In this guide, you’ll learn how to create a Kubernetes Deployment manifest to deploy your Docker image on Google Kubernetes Engine (GKE). We’ll cover:
  1. Creating a Git branch
  2. Writing the Deployment manifest
  3. Understanding each field in the YAML
  4. Next steps for automated deployment

Prerequisites

  • A working GKE cluster
  • kubectl configured to talk to your GKE cluster
  • Docker image pushed to a container registry (e.g., Google Container Registry)

1. Create a New Git Branch

Open your terminal, ensure you’re on main, then create a feature branch:
Make sure you have committed or stashed any local changes before switching branches.
You can confirm the active branch in your IDE’s integrated terminal.

2. Define the Deployment Manifest

In the root of your project, create a file named GKE.yaml. This manifest tells Kubernetes how many replicas to run, which Docker image to use, and which port to expose.

3. Manifest Field Reference

Below is a quick reference for the key fields in GKE.yaml:

4. Verify and Apply the Manifest

Once GKE.yaml is saved, apply it to your GKE cluster:
Check the rollout status:
Always review your manifest for correct image tags and port configurations before applying to production clusters.

5. Next Steps

Now that your Deployment manifest is live, update your CI/CD pipeline to automate this step. For example, extend your cloudbuild.yaml to:
  1. Build and push the Docker image
  2. Run kubectl apply -f GKE.yaml against your GKE cluster
This ensures every merge to main automatically deploys the latest version.

Watch Video