Azure / mec-app-solution-accelerator

Application Solution Accelerator for Multi-access Edge Compute (MEC)
MIT License
37 stars 10 forks source link

[P0] [BUG] Link in Control Plane app to Alerts-UI has the wrong IP-PORT #145

Closed CESARDELATORRE closed 1 month ago

CESARDELATORRE commented 2 months ago

[P0] [BUG] Link en Control Plan app to Alerts-UI has wrong PORT

The root cause can be that it's using a different IP address, why? Previously, we were using the same IP address for all the services (the real IP of the machine) and then we just use different ports for the app. THat's the way it needs to be so we can also access the app from remote machines. We need to use the real machine's IP.

image

It goes to: http://192.168.0.6:88/ --> Tha's not the IP

It should be, if I check the URL in K8s Dashboard: http://192.168.0.4:88/

In the K8s dashboard services I see it like this:

image image

Basically the link needs to find out the IP and port dynamically....

BUT MOST IMPORTANTLY, IT HAS TO USE THEREAL IP OF THE MACHINE, so you can access remotely easier.

Previosly (v 1.8) I think we were using the same IP for all the public services in K8s, as you can see here, the IP 172.30.1.75 for all the public services. But that's not the way I see it in v1.9 with Aio...:

image

virubiotor commented 2 months ago

@CESARDELATORRE Right now the code from the control-plane-ui-service uses the same protocol and IP that the control-plane-app and the 88 port

function useAlertsDashboardUri() {
    const [alertsUiUri, setAlertsUiUri] = useState('');
    useEffect(() => {
        const newUri = `${window.location.protocol}//${window.location.hostname}:88`;
        setAlertsUiUri(newUri);
    }, []);

    return alertsUiUri;
}

Previously (~3 months ago), it used to be an env variable with the address of the Alerts-UI service. I feel like this might be the change you are mentioning. This change was made in this commit: https://github.com/Azure/mec-app-solution-accelerator/commit/f7c60f5797711c20e8575479c6e6528ef9031baa Related issue: https://github.com/Azure/mec-app-solution-accelerator/issues/117#issuecomment-1954921164 image

Should we rollback this changes and use the Cluster IP as an environment variable that must be set by the user? How should this be managed in the deployment script?

CESARDELATORRE commented 2 months ago

The important point is to be able to easily access to the UI apps from remote machines. Usually that's easier if using the machine's IP instead of new IPs, because we should use IPs for the UI apps that have to be in the same IP network where the physical machine is.

For instance, my machine's IP address is: 192.168.1.233

Wireless LAN adapter Wi-Fi:

Connection-specific DNS Suffix . : attlocal.net IPv6 Address. . . . . . . . . . . : 2600:1700:1990:9b40::b IPv6 Address. . . . . . . . . . . : 2600:1700:1990:9b40:5b22:4b05:e8a3:51a5 Temporary IPv6 Address. . . . . . : 2600:1700:1990:9b40:6d86:56f9:64ea:5ad8 Link-local IPv6 Address . . . . . : fe80::d44f:6c6b:da44:9f0e%17 IPv4 Address. . . . . . . . . . . : 192.168.1.233 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : fe80::3aa0:67ff:fe89:ebb2%17 192.168.1.254

But then, the IPs for the control plane app and alerts-UI-dashboard are now: http://192.168.0.6:90/ http://192.168.0.4:88/

That's the internal IP network for Kubernetes where my machine uses this additional network adapter with a different IP Network:

Ethernet adapter vEthernet (aksedgesw-int):

Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::3c64:5b33:221f:dd75%83 IPv4 Address. . . . . . . . . . . : 192.168.0.1 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . :

Can a remote machine in my IP server/machine's IP network access those other IPs which are in a different IP network without doing additional complicated configurations? (i.e. Firewall, Router routes, etc.?)

The important thing is to easily access to the UI apps from remote machines.

I think we should use my machine's real IP and it should also work with LOCALHOST, probably. But for the link, we should be able to find out the machine's IP dynamically without using an ENVIRONMENT VARIABLE to be initialized by the user... that's not a good solution. My ask to CArlos was NOT to use an environment variable for that but dynamically, but he changed to the internal Kubernetes IPs without me knowing that..

CESARDELATORRE commented 1 month ago

More info with clarifications:

Hay una cosa que me confundio para AKS-EE... cuando digo que el cluster usa la IP de la maquina para las apps-UI en la version 1.8, eso por ejemplo lo tenemos asi desplegado y lo acabo de probar en una Ubuntu-VM con K3s, instalado por nuestra cuenta como k3s estandar, nada relacionado con el pre-setup de Aio.

Ahi como ves, la IP de la VM es la misma que la que utiliza la ALERTS DASHBOARD o la CONTROL PLANE:

Esa es la IP desde el Ubuntu de la VM:

image

Esta es la misma IP usandose en la ALERTS UI web App y haciendo PING en remoto desde mi Windows:

image

Lo mismo en la CONTROL PLANE app: image

Esas VMs y MEC-Accelerator estan instalados como lo teniamos en la doc. No hay ningun NGINX ni nada: mec-app-solution-accelerator/docs/K8S_IN_DOCKER_DESKTOP_DEPLOYMENT.MD at mec-accelerator-control-plane-app · Azure/mec-app-solution-accelerator (github.com)

Y logicamente, se puede acceder pro la IP de la Ubuntu-VM en la red de forma remota desde otras maquinas.

Sin embargo, he instalado la v1.8 ahora mismo en el mismo cluster de AKS-EE de mi PC en Windows, y ahi si que veo que usa las IPs diferentes, no la IP de mi maquina de Windows, porque claro, usa la IP de la VM de Hyper-V utilizada para el cluster (internamente LINUX para los containers que son LINUX) de AKS Edge Essentials, pero lo que no se es por que usa ahi unas IPs internas de otra red IP en lugar de IPs de mi misma red IP que mi maquina Windows.

En realidad yo creo que estaba similar/igual el codigo en 1.8 y 1.9 para esto, como decias.

La diferencia es que en Ubuntu VM y k3s, usa la IP de la VM, que es lo que yo recordaba.

En AKS EE, tambien es la IP de la VM en Hyper-V, lo que pasa es que no se por que es una IP de otra red diferente, es lo que hay que investigar... por que en la VMs de AKS-EE usa IPs internas y no de la misma red IP que la maquina de Windows como si hace si es una VM de Ubuntu... ???

Esto es con AKS EE:

image

La pregunta es como hacer para que las IPs usadas por AKS EE en los services sea una IP de la misma red IP que la de la maquina de Windows. Realmente no puede ser la misma IP, pero si podria ser de la misma red...

En el caso de Ubuntu es que claro esta instalado en la misma VM directamente y coincide la IP con la que le hayamos puesto nosotros a la Ubuntu-VM...

Y lo otro es ver que hacer con lo del link desde control-plane hacia Alerts-dashboard, que si podria estar bien lo que hizo Carlos si ves que en la VM de Ubuntu suelta si pone la IP de la VM-Ubuntu en el link de HTML.

CESARDELATORRE commented 1 month ago

Fixed, closing issue.