Question

I'm currently developing two microservices to be deployed on kubernetes, but already facing problems to onboard another person to work on a feature in microservice A.
The dependencies are as follows

Microservice A

  • Database A
  • Redis
  • PubSub (google managed)
  • ConfigMapA
  • Secret PubSub key.json
  • SecretA
  • Microservice B

Microservice B

  • Database B
  • Redis
  • PubSub (google managed)
  • ConfigMapB
  • Secret PubSub key.json
  • SecretB

Now in the repository I've a deployment.yaml for every microservice. This creates the app's deployment + configmap. It is picked up by skaffold and deployed to minikube.

But obviously the app fails to boot if any secret is missing or it cannot reach the other microservice / other dependencies. Also the configmap is opinionated, it sets the expected database and service url to be a specific name to be resolved via kubedns (e.g. http://microservice-b).

Is there a way to manage these dependencies for development? To run service A all dependencies must run. And the dependencies of the dependencies.

Was it helpful?

Solution

obviously the app fails to boot if [...] it cannot reach the other microservice / other dependencies

This is not obvious. It is quite rare to have one service depend on another to boot.

There are exceptions, however. For instance, a minification service may be needed to rebuild static CSS and JavaScript resources, or a certificate service may be required during the boot to get the latest certificates to be used to access the database and other things.

In order to manage such dependency in development, you have two choices:

  • You may fake it. For instance, you may have a fake service hosted locally which delivers fake, development certificates.

  • Or you may rely on the actual, real services. For instance, during the setup step, your app may want to interact with the minification service independently of the environment, so when you start the app locally, it does exactly the same thing as when it's started on the server.

Licensed under: CC-BY-SA with attribution
scroll top