Skip to main content
Extend your GitHub Actions CI/CD pipeline to securely generate a MongoDB secret and deploy your Kubernetes manifests into a development namespace. This ensures automated, secure credential management and consistent application delivery.

1. Configuring the Dev-Deploy Job

Under jobs: in your workflow YAML, add a dev-deploy job that:
  • Replaces placeholders in your manifest files
  • Creates a Kubernetes secret for MongoDB credentials
  • Applies all manifests to your development namespace
Ensure that vars.NAMESPACE, vars.REPLICAS, and your Docker Hub credentials are configured in your GitHub repository settings.

Workflow Steps at a Glance

2. Kubernetes Deployment Manifest

In kubernetes/development/deployment.yaml, reference the mongo-db-creds secret to populate environment variables for your container:
For more on Kubernetes secrets, see Kubernetes Secrets.

3. Why Use a Secret?

Your Dockerfile includes placeholder environment variables:
By leveraging a Kubernetes secret:
  • You avoid hard-coding sensitive data
  • Credentials are injected at runtime
  • Configuration is decoupled from your application image
Never commit real credentials into source control. Use GitHub Secrets and Kubernetes Secrets to manage sensitive data.

4. Verify a Fresh development Namespace

Before deployment, confirm that the namespace is empty:

5. Watching GitHub Actions in Motion

When you push changes, the dev-deploy job runs alongside other CI tasks:
The image shows a GitHub Actions workflow in progress, displaying a series of jobs including unit testing, code coverage, containerization, and deployment.

5.1 Secret Creation Logs

5.2 Applying Manifests

6. Validate Resources in the Cluster

Check that your secret and resources are live:
Retrieve your ingress host:

7. Access the Application

Open the ingress hostname in your browser. You may see a self-signed TLS warning—proceed to view your live Solar System app:
The image shows a stylized representation of the solar system with planets orbiting the sun, alongside a web interface with options to view and search for planets.
Your Solar System application is now running in the development environment, ready for integration testing!

References

Watch Video