0

I want to port our current Development workflow and Deployment (Multiple Repositories with Node.js and Python Microservices) from Ansible to Kubernetes, however I fail to find good resource about best-practices regarding the way to go depending on the environment

Problem: I fail to find a good approach to work with environment variables across different environments and what to use when (.env, configMaps, secrets) without duplicating information

Env Currently Kubernetes
local Repository is cloned locally. Before a commit and push hooks run to lint and run tests. A .env is created by each developer. Before a PR our Azure Pipeline builds the service and runs the tests again. Only on a successful run the PR can be completed NOT CLEAR: Skaffold should be used for local development. A configMap + secrets can be used by Skaffold. What is the best practice to enable hooks (e.g. via husky) and run CI on Azure or similar?
dev Main branch is deployed. A .env file is located on the server which is loaded on application start A configMap is provided for insensitive information + secrets are created for sensitive information on the dev cluster
stage Same as dev Same as dev, but on stage cluster
production Same as dev Same as dev, but on production cluster

Unclear:

  1. A developer will develop using "skaffold dev". Every change will be synced to the Kubernetes Pods. Before each commit or push, the hook should fire though. With husky this will run outside of Kubernetes I guess, as this is defined on NPM level. Therefore there will be no access to env variables I assume?
  2. In addition to 1: Ideally, to have the exact environment locally as in production I would assume that running "docker build *** && npm run test" would make sense, but where does Docker get the .env variables from?
  3. After a successful push the Azure pipeline should check if everything is fine, so 1. build the image 2. start container 3. run tests in container 4. respond with result. Is this possible or even the right way?
New contributor
rStorms is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

rStorms is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.