Hi there,
I have a docker-compose.yml
as follows with frontend
and backend
services.
I tried implementing the endpoints
directive under the Docker compose docs.
version: '3.7'
services:
backend:
container_name: backend
...
ports:
- 4000
postgres:
image: postgis/postgis:14-3.3
...
ports:
- 5432:5432
volumes:
- pgdata:/var/lib/postgresql/data
frontend:
...
ports:
- 3000
volumes:
pgdata:
endpoints:
- path: /
service: frontend
port: 3000
- path: /api
service: backend
port: 4000
When deployed, 2 endpoints showed up (which was expected and correct)
- frontend -
https://someurl.cloud.okteto.net
- backend -
https://someurl.cloud.okteto.net/api
The issue was that the fetch request from the frontend using https://someurl.cloud.okteto.net/api
coudn’t find the api endpoint. Resulting in the following error :
Failed to load resource: the server responded with a status of 404 (Not Found)
I suspect this is a k8s networking issue but Im not sure since I have almost zero experience with k8s (Thats why I love okteto ! )
Really appreciate any help/ advice on this !
Sincerely
Han