I have two apis (api1 and api2) configured and deployed in minikube cluster. Api1 wants to communicate to Api2. I have already configured the annotations and intentions too. However, nothing worked.
my consul config file configuration
First off, welcome to the consul community! Sorry about the issue you’re having, could you provide us with the error message/logs you’re seeing when running the yaml files above?
Hey Amier,
It works perfectly (api-1 can communicate to api-2) when I remove the “connect-inject” annotations. However, It’s not working with consul injections.
I can see it in the logs, prematurely closed the connection whilst api-1 connecting to api-2 but I get responses from both apis, if I trigger those separately from postman
@krishonline One thing that stands out is the Envoy version you are using. Consul 1.10 dosen’t support Envoy 1.20. You can see a list of the supported versions here
@krishonline I wonder if the application is pointing to localhost ?
I see that the env variable PaymentBaseUrl is pointing to the payment-service. Try changing that to localhost http://localhost:5001. That way the traffic will go through the sidecar. Make sure you add the consul annotations back though.
So if you changed the environment variable to PaymentBaseUrl to http://localhost:5001 , can you see if the order-service application is returning any errors in the logs that could provide clues? Same question for the order-service?
@krishonline Envoy started up fine, per the log file. However, in your order-service logs I see it’s returning an error
←[30mfail←[39m←[22m←[49m: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "9HP36TERD", Request id "9HP36TERD:00000003": An unhandled exception was thrown by the application.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
Let’s try this. Can you set the payment service ports to be equal.
I am thinking that might be problem, as the service is expecting traffic on port 80 in the existing definition. But everything we are providing the order-service is pointing to 5001. So either make them the same, or change the order-service environment variable to http://payment-service:80/ But I would recommend sticking to 5001 as port 80 is a lower port and usually requires elevated permissions to open up.