I contacted Azure Support, and they confirmed that what i WANT to do is not possible using EndPointRef, instead the reffered me to the Fabric Observer (https://github.com/microsoft/service-fabric-observer) as a watch dog service.
Service Fabric Http Liveness/Readiness Probes
I have an Asp.Net Core Service running in service fabric.
It exposes a rather default "health" endpoint using the built in health check (https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-6.0)
I figured I could use the SF Readiness/Liveness Http Probes to invoke the same health check and determine liveness and readiness, as described here: https://learn.microsoft.com/en-us/azure/service-fabric/probes-codepackage#http-probe
However that is proving difficult
I have configured the probe as such:
<Policies>
<CodePackagePolicy CodePackageRef="Code">
<Probes>
<Probe Type="Readiness" TimeoutSeconds="2" PeriodSeconds="30" InitialDelaySeconds="30" FailureThreshold="5" SuccessThreshold="2">
<HttpGet Path="/health-status" EndpointRef="ServiceEndpoint" />
</Probe>
</Probes>
</CodePackagePolicy>
</Policies>
The EndPointRef is largely useless, because the "ServiceEndpoint" in the ServiceManifest looks like this:
<Resources>
<Endpoints>
<Endpoint Name="ServiceEndpoint" />
</Endpoints>
</Resources>
And the Kestrel Communication listener looks like this:
new ServiceInstanceListener(
serviceContext => new KestrelCommunicationListener(
serviceContext,
(url, listener) =>
{
return WebHost
.CreateDefaultBuilder<TStartupType>(Array.Empty<string>())
.ConfigureServices(services =>
{
services.AddSingleton<ServiceContext>(serviceContext)
.AddSingleton(serviceContext)
})
.UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.UseUniqueServiceUrl | ServiceFabricIntegrationOptions.UseReverseProxyIntegration)
.UseStartup<TStartupType>()
.UseUrls(url)
.Build();
})
It seems like the Health Probes does not understand my configuration.
So I added "ServiceEndpoint" to the name in the ServiceInstanceListener, and I added Protocol='http' and Type='input' to the ServiceManifest.
Now I can see the requests in the kestrel log, but they are all on port 80.
Is there anyway I can get the health probes to forward the request to my service without binding it to a static port and location (i.e. let me use unique Urls!).