oakestra / oakestra-net

Networking component of Oakestra
Apache License 2.0
6 stars 8 forks source link

How to use semantic addresses in detail? #165

Closed skyrimforest closed 4 months ago

skyrimforest commented 8 months ago

Short

Can't access microservices using semantic addresses.

Proposal

Solution

Status

I deployed an application in oakestra which consists of 2 microservices, I assigned them with rr_ip like 10.30.0.1 and 10.30.0.2. Howerver I can't access it, for example ,when I type http://10.30.0.2:80 in browser, I can't see my front page, and I have to use my NodeIP like http://192.168.227.133:80 to see it. What's more, when I use axios post to post http request to http://10.30.0.1/index, it fails too. Please tell me how to use semantic in detail?

Checklist

giobart commented 8 months ago

Hello @skyrimforest thanks for your issue. Semantic IP addresses can be used only for service to service communication. So Microservice A can use rr_ip 10.30.0.1 to communicate with Microservice B. But you as external client from your browser can only use the NodeIP as you did, correctly. A good alternative strategy for your usecase would be to deploy a proxy/gateway microservice that then dispatches the requests to an internal rr_ip. E.g.

               node1:80
                   |                                             +---> [microservice_A_instance_1] 
                   |                                             |
client ------>[proxy microservice]----rr_ip_microservice_A-------+---> [microservice_A_instance_2]
                   |                                             |
                   |                                             +---> [microservice_A_instance_n]
skyrimforest commented 8 months ago

Hello @skyrimforest thanks for your issue. Semantic IP addresses can be used only for service to service communication. So Microservice A can use rr_ip 10.30.0.1 to communicate with Microservice B. But you as external client from your browser can only use the NodeIP as you did, correctly. A good alternative strategy for your usecase would be to deploy a proxy/gateway microservice that then dispatches the requests to an internal rr_ip. E.g.

               node1:80
                   |                                             +---> [microservice_A_instance_1] 
                   |                                             |
client ------>[proxy microservice]----rr_ip_microservice_A-------+---> [microservice_A_instance_2]
                   |                                             |
                   |                                             +---> [microservice_A_instance_n]

Thank you! I will give it a try!

skyrimforest commented 8 months ago

Hello @skyrimforest thanks for your issue. Semantic IP addresses can be used only for service to service communication. So Microservice A can use rr_ip 10.30.0.1 to communicate with Microservice B. But you as external client from your browser can only use the NodeIP as you did, correctly. A good alternative strategy for your usecase would be to deploy a proxy/gateway microservice that then dispatches the requests to an internal rr_ip. E.g.

               node1:80
                   |                                             +---> [microservice_A_instance_1] 
                   |                                             |
client ------>[proxy microservice]----rr_ip_microservice_A-------+---> [microservice_A_instance_2]
                   |                                             |
                   |                                             +---> [microservice_A_instance_n]

@giobart Hello! I tried the architecture as you drawed upon, it is nice to see that I can access my Fastapi project from a porxy! However, when I am trying to deploy more services(for example like the microservice_A on the picture), I can get microservice_A_instance_1, microservice_A_instance_2 and so on. image I try to print all logs of the instances, where I showed their host name. But I can only see the hostname of the first instance. fastapi What's happening? Does the rr algorithm really take effect?

giobart commented 8 months ago

Hello, sorry for the late response, I did not notice this issue. What is the current setup? Is fastapi01 using RR address to contact fastapi02? Moreover, for general questions like this I would recommend using our Discord channel https://discord.gg/7F8EhYCJDf we have a dedicated support forum. Over there we're generally more reactive :D

skyrimforest commented 8 months ago

Hello, sorry for the late response, I did not notice this issue. What is the current setup? Is fastapi01 using RR address to contact fastapi02? Moreover, for general questions like this I would recommend using our Discord channel https://discord.gg/7F8EhYCJDf we have a dedicated support forum. Over there we're generally more reactive :D @giobart Thank you and I have joined this forum, for more info about my setup I will show you later. Appreciate your help!

skyrimforest commented 4 months ago

您好,您的邮件我已收到!