I'm doing some tests with Dapr that are not working, the scenario is not very common (for the moment it's just a few tests). It is that a Web App deployed in Azure uses a Dapr sidecar that is also located in azure, but that does not run, let's say, in the same "network". In this case, the sidecar is a deployment/service in AKS. In the Dapr documentation I haven't seen any impediment for an application and its sidecar to communicate via internet (yes, I know it's a weird scenario). Is this the case? That is to say, is it true that in theory there is no impediment to do this?
The deployment of the Sidecar is as follows.
apiVersion: apps/v1
kind: Deployment
metadata:
name: dapr-sidecar
spec:
selector:
matchLabels:
app: dapr-sidecar
replicas: 1
template:
metadata:
labels:
app: dapr-sidecar
spec:
containers:
- name: daprd
image: "daprio/daprd:latest"
imagePullPolicy: Always
command:
- "./daprd"
args:
- "--app-id"
- "daprtestbackend"
- "--app-port"
- "80"
- "--dapr-grpc-port"
- "50001"
- "--dapr-http-port"
- "8078"
- "--components-path"
- "/components"
- "--log-level"
- "debug"
volumeMounts:
- name: components-volume
mountPath: /components
ports:
- containerPort: 50001
name: grpc-port
- containerPort: 8078
name: http-port
volumes:
- name: components-volume
configMap:
name: dapr-components
---
apiVersion: v1
kind: Service
metadata:
name: dapr-sidecar-service
spec:
selector:
app: dapr-sidecar
ports:
- name: grpc
port: 50001
targetPort: 50001
- name: http
port: 8078
targetPort: 8078
type: LoadBalancer
On the web application side, I basically do the following:
// Here I basically put the IP of the AKS Service (load balancer type) and the port that
// I have configured there, I have tried with HTTP, gRPC etc...
const string httpEndPoint = "http://{SERVICE_SIDECAR}:{PORT}";
builder.Services.AddDaprClient(options =>
{
options.UseHttpEndpoint(httpEndPoint);
});
...
...
// Dapr will send a serialized event object instead of a raw CloudEvent.
app.UseCloudEvents();
// required for Dapr's pub/sub routing.
app.MapSubscribeHandler();
// Dapr subscription in [Topic] routes topic requests to this path
app.MapPost("/jobs", [Topic("jobpubsub", "jobs")] (Job job) => {
Console.WriteLine("Call to /jobs");
/Register the job
Console.WriteLine("Subscriber received : " + job);
return Results.Ok(job);
});
...
I have tried with gRPC, HTTP, but there is no way to get messages.... any advice?