development namespace using GitLab CI/CD. You’ll learn how to integrate secret creation into your pipeline and verify a successful deploy.
1. Verify the Development Namespace
First, confirm thedevelopment namespace is clean:
Always ensure you’re targeting the correct namespace before deploying to avoid unintended changes.
2. Initial CI Job Definition
Here’s a basick8s_dev_deploy job from .gitlab-ci.yml:
At this stage, deployment will fail because the application requires a
mongo-db-creds secret that doesn’t exist yet.3. Required Manifests
Define the Kubernetes resources for your application. Below are two essential manifest examples:Ingress
Deployment
The
mongo-db-creds secret must include:
MONGO_URIMONGO_USERNAMEMONGO_PASSWORD
4. Create Secret and Update CI Job
Incorporate secret creation into your pipeline before applying manifests:Using
--dry-run=client -o yaml ensures idempotent secret creation.5. Pipeline Configuration
Define the overall GitLab pipeline, stages, and variables:
Include a containerization job if needed:

6. Inspect the Dev-Deploy Logs
Yourdev-deploy job logs should look like this:
7. Verify Deployment Locally
Check all resources indevelopment:


8. Next Steps
To improve reliability, integrate health checks into your pipeline:GET /live→{"status":"live"}GET /ready→{"status":"ready"}, HTTP 200