# How to Build Ephemeral PR Preview Environments on GKE with GitHub Actions, Ingress, and Automatic TLS

DevFeed: [How to Build Ephemeral PR Preview Environments on GKE with GitHub Actions, Ingress, and Automatic TLS](<https://devfeed.tech/articles/how-to-build-ephemeral-pr-preview-environments-on-gke-with-github-actions-ingress-and-automatic-tls-88112.md>)

Original publisher: [Read original article](<https://www.freecodecamp.org/news/build-ephemeral-pr-preview-environments-on-gke-with-github-actions-ingress-automatic-tls/>)

Author: Amina Lawal

Published: 2026-10-15T13:35:48Z

Content type: tutorial

Language: en

Sources: [Free Code Camp](<https://devfeed.tech/sources/freecodecamp-programming-tutorials-python-javascript-git-more.md>)

Topics: [CI/CD](<https://devfeed.tech/topics/cicd.md>), [GitHub](<https://devfeed.tech/topics/github.md>), [Gke](<https://devfeed.tech/topics/gke.md>), [ingress-nginx](<https://devfeed.tech/topics/ingress-nginx.md>), [observability](<https://devfeed.tech/topics/observability.md>)

Tags: [added](<https://devfeed.tech/tags/added.md>), [artifact-registry](<https://devfeed.tech/tags/artifact-registry.md>), [branch](<https://devfeed.tech/tags/branch.md>), [ci-cd](<https://devfeed.tech/tags/ci-cd.md>), [ephemeral](<https://devfeed.tech/tags/ephemeral.md>), [github](<https://devfeed.tech/tags/github.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [gke](<https://devfeed.tech/tags/gke.md>), [ingress](<https://devfeed.tech/tags/ingress.md>), [kubernetes](<https://devfeed.tech/tags/kubernetes.md>), [preview-environments](<https://devfeed.tech/tags/preview-environments.md>), [terraform](<https://devfeed.tech/tags/terraform.md>), [tls](<https://devfeed.tech/tags/tls.md>)

## AI overview

This tutorial walks through building isolated preview environments for GitHub pull requests on Google Kubernetes Engine. It uses GitHub Actions and Terraform to build and deploy PR-specific containers, authenticates to Google Cloud with Workload Identity Federation, and routes previews through a shared ingress controller with automatically issued TLS certificates. It also covers teardown workflows and scheduled cleanup for abandoned environments.

## Source excerpt

Every team that ships software eventually builds a staging environment. And every team that builds a staging environment eventually discovers the same problem. Staging is shared. One environment, many