edgedb / edgedb-docker

Official Docker Image packaging for EdgeDB
81 stars 16 forks source link

K8S issue: Port is not a valid integer #69

Open midzdotdev opened 1 year ago

midzdotdev commented 1 year ago

I started out this issue as a question, but now it's much more an answer to running EdgeDB on K8S.

I've seen this is a common issue for other packages (here and here), but I was surprised this hadn't already been reported for EdgeDB. To my eyes, taking a look at the entrypoint script EdgeDB's fix seems more involved than simply amending the container's environment variables.

Problem

Running a pod using edgedb/edgedb without overriding any environment variables gives me the following logs in my k8s dashboard.

Usage: edgedb-server.py [OPTIONS] COMMAND [ARGS]...
Try 'edgedb-server.py -h' for help.
Error: Invalid value for '-P' / '--port': 'tcp://10.245.182.142:5656' is not a valid integer

Running with EDGEDB_SERVER_PORT=5656 gives:

ERROR: EDGEDB_SERVER_PORT and EDGEDB_PORT are exclusive, but both are set.

EDGEDB_PORT is used as environment variable in the docker entrypoint script. We have to overwrite this.

Solution

Specify EDGEDB_PORT=5656 as an environment variable. The EdgeDB server will bind to 0.0.0.0 of the container and then you can expose the 5656 using a Kubernetes service object.

I'll leave this open and wait to be responded to and closed by an admin for SEO purposes.

To the EdgeDB contributors, would you be happy for Kubernetes to be added to the 'Deployments' section of the docs? We could include an example pod and service.

elprans commented 1 year ago

Ah, this is an annoying and dubious behavior of docker --link that is inherited by k8s. I think we can find a way to handle this nicely without the need for special cases, like we do in edgedb-python.