GCP DevOps Project
Sprint 07
Sprint 07
In Sprint 07, we’ll enhance our GKE-based CI/CD pipeline by introducing a dedicated development environment. This sandbox allows developers to validate changes safely before they reach production.
Objectives
- Create a development namespace in the GKE cluster.
- Configure branch-based deployments:
- Pushing to the
developmentbranch deploys to the development namespace. - Merging into the
mainbranch deploys to production.
- Pushing to the
Whenever a developer pushes code to development, the pipeline triggers a rollout into the dev namespace. After tests and QA pass, merging into main initiates the production release.
Note
A development environment provides an isolated namespace in your GKE cluster for testing and validation of changes without impacting production.
Learn more in the Kubernetes Namespaces documentation.


Branch-to-Namespace Mapping
| Git Branch | Kubernetes Namespace | Trigger Event |
|---|---|---|
| development | dev | git push to develop |
| main | production | Pull request merge into main |
Updating the CI/CD Pipeline
Most CI/CD stages stay the same; we’ll only adjust:
- Namespace creation steps.
- Deployment job triggers.
1. Create the Development Namespace
kubectl create namespace dev
2. Update Pipeline Configuration
In your CI/CD YAML (e.g., Cloud Build or GitHub Actions), add branch filters:
# Example GitHub Actions snippet
on:
push:
branches:
- development
pull_request:
branches:
- main
jobs:
deploy-dev:
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
steps:
- name: Deploy to Dev Namespace
run: |
kubectl config use-context gke-cluster
kubectl apply -f k8s/ --namespace=dev
deploy-prod:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Deploy to Production
run: |
kubectl config use-context gke-cluster
kubectl apply -f k8s/ --namespace=production
Next Steps
- Validate the development environment by pushing a test commit to
development. - Review logs and confirm the new namespace deployment.
- Merge into
mainand watch the production rollout.
For more on CI/CD best practices with Kubernetes, see the Kubernetes CI/CD guide.
Watch Video
Watch video content