Skip to main content
In this guide, you’ll learn how to deploy your application to a Kubernetes development environment using GitHub Actions. We’ll assume your Kubernetes manifests already contain the correct values, then show you how to add a dev-deploy job that replaces tokens, creates a MongoDB secret, and applies your manifests.

1. Update the GitHub Actions Workflow

Open .github/workflows/main.yml and add the dev-deploy job:

2. Kubernetes Deployment Manifest

Ensure your deployment.yaml in kubernetes/development/ references the secret for environment variables:

3. Repository Variables and Secrets

Configure the following under Settings > Secrets and variables in your GitHub repository.
The image shows a GitHub repository settings page focused on "Secrets and variables" under "Actions." It displays options for managing environment and repository variables, with some variables listed.

4. Running the Workflow

Push your changes to main or any feature/* branch. Then, monitor the pipeline in the Actions tab of your repository.
The image shows a GitHub Actions page for a repository named "solar-system," displaying a list of workflow runs with their statuses and details.
The dev-deploy job runs after the docker job (and its dependencies: unit-testing and code-coverage). It checks out the repo, replaces tokens, creates the MongoDB secret, and applies the Kubernetes manifests.
The image shows a GitHub Actions workflow in progress, displaying a series of jobs including unit testing, code coverage, containerization, and deployment. The workflow is visualized with a flowchart indicating the status of each step.

5. Verifying in Kubernetes

Once the workflow succeeds, confirm the resources:
You should see:
  • mongo-db-creds secret
  • Deployment and Pods for solar-system
  • Service and Ingress resources

6. Accessing the Application

Retrieve and open the ingress endpoint:
Open the HOSTNAME in your browser.
If you encounter a self-signed certificate warning, safely accept it to proceed to the application.

This lesson covers creating a Kubernetes secret and deploying to a development cluster via GitHub Actions. Integration testing for this deployment will be addressed in an upcoming article.
  • [GitHub Actions Documentation][GitHub Actions]
  • [GitHub Secrets and Variables][GitHub Secrets and Variables docs]
  • [Kubernetes Secrets][Kubernetes Secrets]
  • [Kubernetes Ingress][Ingress docs]

Watch Video