How to delete multiple instances in microservice deployment

Product/components used and version/fix level:

Cumulocity Production

Detailed explanation of the problem:

Hi, I have few questions:

  1. How to delete the multiple instances, I dont know how multiple instances got deployed but we want to delete one of them.

  2. How to make sure that multiple instances shouldn’t get deployed?

  3. In status bar of my microservice I can see there is 1 in unhealthy, what does that mean and how can I make it right?

Please refer to the image below:

We are using Spring Boot for this microservice and multiple properties file to maintain the environment.

Best Regards,
Samanyu

Hi,

Is there any update on this? How can we resolve this?

Hoping someone gives a solution to this.

Thanks & Regards,
Samanyu

Multiple instances of a microservice are created because of two reasons: if you have specified replicas in the microservice manifest, Cumulocity will start as many instances as you have specified of your microservice. In your case, the reasons seems to be that you have restarted the microservice or deployed a new version. In that case, the old instance will remain active until the new one becomes healthy. Depending on your microservice this can take a few seconds to a few minutes.

If you observe that this is not resolved, you can unsubscribe your microservice from you tenant. In that case, the number of instances should go down to 0 (healthy and unhealthy). If you then subscribe again you should be back to a single healthy instance. If that is not helping, you can delete the microservice and re-deploy it. If even that is not helping, I would suggest to open a support ticket to get somebody from the operations team to look at the issue.

Hi Harald,

So I unsubscribed and subscribed, and I got this. What does this mean and how can I resolve it :thinking:

Thanks & Regards,
Samanyu

This means that the microservice is starting. It says desired “1” because the goal is to have one instance running but the one instance is still in an unhealthy state. It can take some time until the microservice becomes healthy. It depends on your microservice implementation and how you have specified the liveness and readiness probes in you microservice manifest. Especially also the “initalDelaySeconds” will define how long Cumulocity will wait after a start to check for these. E.g. if you have set them to 240, it will take 4 minutes before Cumulocity even checks if you microservice is running.

Okay so as you can see in the manifest file it says 30 so the service should become healthy in 30 seconds but it’s been 20 mins since the deployment and it didn’t become healthy. According to the logs, I can see that my application is started but in the status section, I can still see that it shows active 0 and unhealthy 1. Is there any way to make it healthy and active? When I hover on that red triangle, it says application down so how can i make it run again

Also, I can see in deployment events:-

Jun 2023, 12:44:11

Deployment was changed

DETAILS

* Time23 Jun 2023 12:44:11
* Server creation time23 Jun 2023 12:44:11
* Typec8y_Application__DeploymentChange
* Last updated23 Jun 2023 12:44:11
* Application__ metadata{ "owner": "t41566", "tenant": "t41566" }

23 Jun 2023, 12:36:06

Started container dataingestion-service-scope-t41566-pod

DETAILS

* Time23 Jun 2023 12:36:06
* Server creation time23 Jun 2023 12:36:06
* Typec8y_Application__Started
* Last updated23 Jun 2023 12:36:06
* Application__ metadata{ "owner": "t41566", "tenant": "t41566" }

What does this mean?

My Cumulocity.json file:

{
	"apiVersion": "1",
	"version": "1.0.46",
	"provider": {
		"name": "dataingestion-microservice"
	},
	"isolation": "PER_TENANT",
	"resources": {
        "cpu": "1",
        "memory": "1024M"
    },
	"requiredRoles": [
		"ROLE_INVENTORY_READ",
		"ROLE_INVENTORY_CREATE",
		"ROLE_INVENTORY_ADMIN",
		"ROLE_MEASUREMENT_READ",
		"ROLE_MEASUREMENT_ADMIN",
		"ROLE_ALARM_READ",
		"ROLE_ALARM_ADMIN",
		"ROLE_IDENTITY_READ",
		"ROLE_IDENTITY_ADMIN",
		"ROLE_EVENT_READ",
		"ROLE_EVENT_ADMIN",
		"ROLE_TENANT_MANAGEMENT_ADMIN",
		"ROLE_TENANT_MANAGEMENT_READ",
		"ROLE_OPTION_MANAGEMENT_READ",
		"ROLE_OPTION_MANAGEMENT_ADMIN"
	],
	"livenessProbe": {
		"httpGet": {
			"path": "/health",
			"port": 80
		},
		"initialDelaySeconds": 30,
		"periodSeconds": 10
	},
	"readinessProbe": {
		"httpGet": {
			"path": "/health",
			"port": 80
		},
		"initialDelaySeconds": 30,
		"periodSeconds": 10
	}
}

ok that is strange:

  • You are using the Java SDK, right? If not can you make sure that you actually implement the “/health” endpoint in your microservice?
  • Can you delete the microservice and deploy it again?
  • If the problem persists, I recommend to open a support request.

It wasn’t working because the roles were deployed without the sdk configuration. After removing the roles, it worked perfectly fine. Thank you for your help :slight_smile:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.