Skip to main content
Deploying to a Kubernetes production cluster involves extending your existing CI/CD pipeline. In this guide, we’ll walk through updating a GitHub Actions workflow to add production deployment jobs, enforce environment protection rules, and validate your release.

1. Workflow Skeleton

Begin by defining the workflow trigger, environment variables, and placeholders for your jobs:

2. Reference: Development Jobs

Use these dev-deploy and dev-integration-testing jobs as templates. They build, deploy to a development namespace, and verify the app is live.
For more on kubectl commands, see the kubectl Reference.

3. Adding Production Jobs

3.1 prod-deploy

Duplicate the dev-deploy job, adjust manifests, and target your production environment. This job also captures the load balancer IP for your Ingress controller.

3.2 prod-integration-testing

Once the production deploy finishes, verify the live endpoint:

4. Consolidated Jobs Table

5. Running the Workflow

  1. Commit and push your changes to main or a feature/* branch.
  2. Trigger the workflow manually or via a push event.
  3. Monitor the sequential execution: dev jobs ➔ prod-deploy ➔ prod-integration-testing.
If prod-deploy is blocked by branch protection or environment rules, you’ll see an error and the integration test will be skipped.
The image shows a GitHub Actions workflow summary with several jobs, some of which have failed. There are annotations indicating errors related to code coverage and deployment protection rules.

6. Environment Protection Rules

Configure deployment protection rules in your repository settings to enforce review policies, wait timers, or required approvals before production deployments.
The image shows a GitHub settings page for configuring deployment protection rules in a repository environment. It includes options for required reviewers, self-review prevention, and a wait timer.
Triggering from an unauthorized branch (e.g., a feature branch without approval) will block prod-deploy. Subsequent jobs will be skipped.
The image shows a GitHub Actions workflow interface with a failed job in the "prod-deploy" stage. It includes details of various testing and deployment steps, with some marked as successful and others as failed.

Watch Video