I do have a spring boot microservice(SERVICE A) & Artemis JMS server running inside the Azure AKS cluster and React web application serving the static pages also from within the cluster. These three applications have Kubernetes deployment and service resources and are deployed using a helm chart.
Now I need to spin up another microservice on demand whenever the user creates an entry from UI. For example, I do have pre-defined Kubernetes resources(as helm chart) for Customer microservice but only need to spin up the microservice when user creates a customer, also every time a new customer created, I need to spin up another customer microservice instance. I also need to pass the customer name as an environment variable to the customer microservice every time it is being created so each customer microservice can subscribe to a particular topic.
Is there a way to achieve this? I also, want to manage the created microservice. for example, when the customer is deleted then I need to delete the Kubernetes resources related to the customer. Is it easy to achieve this using a helm chart? but I want to know how to manage the helm chart from within the running Spring boot application.
Can this be achieved using the Fabric8 library?
Any suggestions would be greatly helpful.
You don't really need a Helm chart for this. In general, you can access the Kubernetes API from an application running in the cluster in the same way as from outside the cluster. The Kubernetes API is an HTTP REST API and you just have to make HTTP requests to it with proper authentication credentials.
Since you're using Java, you could use the official Java client library for Kubernetes to access the Kubernetes API and create/delete any resources directly from your application code.
The Java client library also assists you for using the right authentication and takes care of any other details.