Migrate Eureka Server or Tanzu Service Registry to managed Eureka Server for Spring in Azure Container Apps
Note
The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.
The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.
This article applies to: ✅ Basic/Standard ✅ Enterprise
This article describes how to migrate Eureka Server to Eureka Server for Spring in Azure Container Apps.
Azure Container Apps' managed Eureka Server for Spring offers a similar experience to Azure Spring Apps. It enables you to deploy existing Spring applications without modifying their source code and register them with the managed Eureka Server.
Prerequisites
- An existing Azure Spring Apps Enterprise plan instance with the Tanzu Service Registry enabled.
- An existing Azure container app environment used to deploy applications. For more information, see Provision Azure Container Apps.
- A container image of the application acting as a Eureka client. If necessary, you can use the sample image
mcr.microsoft.com/javacomponents/samples/sample-service-eureka-client:latest
. - Azure CLI.
Provision managed Eureka Server for Spring
To use the Managed Eureka Server for Spring, you first need to create the Eureka Server component within your Azure Container Apps environment.
To create the managed Eureka Server for Spring, use the following steps:
To create the Eureka Server for Spring Java component, use the following command:
az containerapp env java-component eureka-server-for-spring create \ --resource-group $RESOURCE_GROUP \ --name $EUREKA_COMPONENT_NAME \ --environment $ENVIRONMENT
(Optional) To update the Eureka Server for Spring Java component configuration, use the following command:
az containerapp env java-component eureka-server-for-spring update \ --resource-group $RESOURCE_GROUP \ --name $EUREKA_COMPONENT_NAME \ --environment $ENVIRONMENT \ --configuration eureka.server.renewal-percent-threshold=0.85 eureka.server.eviction-interval-timer-in-ms=10000
When you delete the managed Eureka Server through the Azure portal, Azure Container Apps automatically unbinds all container apps registered with it and deletes the managed Eureka Server. This behavior differs from the Azure Spring Apps Enterprise Plan, where you must manually unbind services before deleting the Tanzu Service Registry.
Resource allocation and pricing
The container resource allocation for the managed Eureka Server in Azure Container Apps is fixed to the following values:
- CPU: 0.5 vCPU
- Memory: 1 Gi
- Replicas: 1 - not scalable
In comparison, the Azure Spring Apps Enterprise Plan Service Registry also provisions fixed resources but includes two replicas, each with 0.5 vCPU and 1 Gi memory.
Unlike the Basic/Standard plans in Azure Spring Apps, which aren't charged, the managed Eureka Server for Spring in Azure Container Apps operates under consumption-based pricing. This pricing is similar to the pricing of the Azure Spring Apps Enterprise Plan.
For more information, see the Considerations section of Tutorial: Connect to a managed Eureka Server for Spring in Azure Container Apps.
Deploy and bind an application
After you provision the managed Eureka Server for Spring, you can deploy your Spring application to Azure Container Apps and bind it to the Eureka Server. This process is similar to how the Enterprise Plan works in Azure Spring Apps. Specifically, you need to bind your application to the Eureka Server, which is different from the Azure Spring Apps Basic/Standard Plan where no binding is required.
Note
If you aren't using the sample image mcr.microsoft.com/javacomponents/samples/sample-service-eureka-client:latest
to deploy an application, you might need to do some configuration to enable Azure Container Apps to pull images from your container registry. For example, to prepare the necessary permissions to pull images from Azure Container Registry (ACR), see the Create an Azure Container Registry section of Tutorial: Build and deploy your app to Azure Container Apps.
Deploy the application
Use the following command to create a container application:
az containerapp create \
--resource-group $RESOURCE_GROUP \
--name $APP_NAME \
--environment $ENVIRONMENT \
--image $IMAGE \
--min-replicas 1 \
--max-replicas 1 \
--ingress external \
--target-port 8080 \
--query properties.configuration.ingress.fqdn
Bind the application
After you successfully create the application, you can bind the application to the managed Eureka Server.
Use the following command to bind the created application to the Eureka Server:
az containerapp update \
--resource-group $RESOURCE_GROUP \
--name $APP_NAME \
--bind $EUREKA_COMPONENT_NAME \
--query properties.configuration.ingress.fqdn
The binding injects several configurations into the application as environment variables, primarily the eureka.client.service-url.defaultZone
property. This property indicates the internal endpoint of the Eureka Server Java component. For more information about other properties, see the Bind your container app to the Eureka Server for Spring Java component section of Connect to a managed Eureka Server for Spring in Azure Container Apps.
If you need to unbind your application from Eureka Server, see the Unbind your container app from the Eureka Server for Spring Java component section of Connect to a managed Eureka Server for Spring in Azure Container Apps.
View the registered applications with a dashboard
After you successfully create your application and bind it to the Eureka Server, you can view the registered applications through a management dashboard. For more information, see the View the application through a dashboard section of Connect to a managed Eureka Server for Spring in Azure Container Apps.
The following screenshot shows an example of what the Eureka Server dashboard looks like:
Troubleshooting
You can view logs for the managed Eureka Server for Spring in Azure Container Apps using Log Analytics, which works similarly to the logging mechanism in Azure Spring Apps.
To view managed Eureka Server for Spring logs in Azure Container Apps, use the following steps:
Go to the Container App Environment page.
Go to Monitoring > Logging options, and, under Logs Destination, ensure Azure Log Analytics is selected.
Go to Monitoring > Logs.
(Optional) If the Log analytics scope doesn't match the one configured in Logging options, select Select scope to choose the correct log analytics workspace.
Enter your query into the query editor to view logs from the ContainerAppSystemLogs_CL table, as shown in the following example:
ContainerAppSystemLogs_CL | where ComponentType_s == "SpringCloudEureka" | project Time=TimeGenerated, ComponentName=ComponentName_s, Message=Log_s | take 100
For more information on querying logs using the Azure CLI, see Monitor logs in Azure Container Apps with Log Analytics.
Known limitations
- External access: The managed Eureka Server for Spring in Azure Container Apps can't be accessed externally.
- Revision traffic: In Azure Container Apps' multiple revision mode, all replicas of the application registered in Eureka receive traffic.
More resources
For more information on managing Eureka Server in Azure Container Apps, see Tutorial: Connect to a managed Eureka Server for Spring in Azure Container Apps.