When you register a persistent service provider with a Microservices Engine (MSE) Nacos instance, HTTP and TCP health checks always report the instance as unhealthy -- even if the instance is running normally.
Why this happens
Nacos uses two health check models depending on the instance type:
| Instance type | Parameter | Health check direction | How it works |
|---|---|---|---|
| Ephemeral (default) | ephemeral=true | Instance to server | The service instance sends heartbeats to the Nacos server. |
| Persistent | ephemeral=false | Server to instance | The Nacos server actively probes the service instance by sending HTTP or TCP requests to it. |
MSE Nacos is a managed service that runs in an isolated network, separate from your applications. For security, the network layer blocks outbound requests from the MSE Nacos server to service instances. Because persistent instances rely on server-initiated probes, health checks always time out and report the instance as unhealthy.
Ephemeral instances are unaffected because the health check direction is reversed: the instance sends heartbeats to the Nacos server, which the network layer allows.
Solution: switch to ephemeral instances
Register the service as ephemeral by setting ephemeral to true. Because true is the default value, removing the ephemeral parameter entirely has the same effect.
Open API
curl -d 'serviceName=<your-service-name>' \
-d 'ip=<your-instance-ip>' \
-d 'port=<your-instance-port>' \
-d 'ephemeral=true' \
-X POST 'http://<nacos-server-address>/nacos/v2/ns/instance'Replace the placeholders with your actual values:
| Placeholder | Description | Example |
|---|---|---|
<your-service-name> | Service name | my-service |
<your-instance-ip> | IP address of the service instance | 192.168.1.100 |
<your-instance-port> | Port of the service instance | 8080 |
<nacos-server-address> | MSE Nacos instance address | mse-xxx.nacos.mse.aliyuncs.com:8848 |
Spring Cloud Alibaba
Add the following property to your application configuration:
spring.cloud.nacos.discovery.ephemeral=trueIf your configuration does not explicitly set ephemeral, the default is already true and no change is needed. Look for an explicit ephemeral=false setting and remove or change it.