Search code examples
kubernetescontinuous-integrationmicroservices

Best way to make sure correct version of code is deployed to kubernetes?


Context

I have few microservices and few environments (dev, test, prod-clientA, prod-clientB), git repository and gitlab CI/CD pipeline for building and deploying images.

Problem

When a feature doesn't work, it's hard to guess if this is a bug or an error like:

  • deployed the wrong version of the container,
  • container version is correct but the features code isn't there for some reason,
  • configuration issue (e.g. environment variables set to incorrect values)

Expected solution

I'm looking preferably for a tool that will display a dashboard containing:

  • running containers with version
  • some information about the code inside container, e.g. version, commit log, build time...
  • environment variables passed to the container.

I will be grateful for any suggestions.


Solution

  • I am considering, you have CI/CD jenkins pipeline in place to generate the artifact and Bush to nexus repository(Whatever your repository) of the microservice.

    For minor changes, there will be a minor version of the release. For e.g. If the current release in env is 1.5, then minor releases will be like 1.5.1(for bug fixes and small issue fixes) and the major version will be 1.5.

    In bitbucket, you can also maintain the same things while maintaining the code. You have to maintain the release branches like 1.5.

    This way you can maintain the both code and release artificat.

    About to check the pod version and other details. You can check the container info section in k8s. Which maintains the image tag version, repository URL, and many things.

    Please check the below URL for more information.

    https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/