Because I am new in the DevOps, I don't know where I need to apply the changes to correctly run the project.

The structure:

Git → Jenkins → Docker build -> Kubernetes (deploy)

Is it better to make the change of variables in the project, (example: password, database connection, etc.) to Jenkins, Kubernetes, or Docker?

Example:

With docker-compose I use an environment variable to change the variable inside my code.

    environment:
      MONGO_INITDB_ROOT_USERNAME: user
      MONGO_INITDB_ROOT_PASSWORD: user

I want to change this variable and run correctly in the production environment.

I don't know where it is the best to change the variable, Jenkins, Kubernetes with [Ansible][1], etc.

  [1]: https://en.wikipedia.org/wiki/Ansible_(software)