Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing containers - --reverse-proxy / --inspector #17

Closed
rcgeorge23 opened this issue Jul 18, 2022 · 2 comments
Closed

Accessing containers - --reverse-proxy / --inspector #17

rcgeorge23 opened this issue Jul 18, 2022 · 2 comments

Comments

@rcgeorge23
Copy link
Contributor

I am struggling a bit trying to understand how best to access containers that kubedock has created.

I have created a simple integration test that depends on a mysql container. If I use kubedock in --reverse-proxy mode, I can see that when my test asks testcontainers for the mysql container db url, it is given the fully qualified kubedock hostname with the random port that has been assigned to the mysql instance:

Waiting for database connection to become available at jdbc:mysql://kubedock.xxx.svc.cluster.local:57636/yyy using query 'SELECT 1'

Unfortunately, because I have not exposed this port explicitly in the kubedock service config, it times out while trying to obtain a connection.

If I remove the --reverse-proxy flag and instead try to use --inspector, I can see that a k8s service has been created for my mysql container with the random port exposed, however when my test asks testcontainers for the mysql db url, it is still given the kubedock hostname rather than that of the mysql service.

So I guess my question is, what is the expected use case for the --inspector flag? Is there some way I can get testcontainers to provide me with the container's service name rather than the kubedock service name?

@rcgeorge23
Copy link
Contributor Author

I guess this is why the recommendation is that kubedock runs as a sidecar...

@joyrex2001
Copy link
Owner

So I guess my question is, what is the expected use case for the --inspector flag? Is there some way I can get testcontainers to provide me with the container's service name rather than the kubedock service name?

In some cases there is no port exposed when starting the container. In that case kubedock doesn't expose ports either. The --inspector flag will query the registry for that specific image to see if there were any default ports exposed via the image itself. If so, it will reverse-proxy/port-forward these ports as well. This will increase compatibility, but note that the occasions where this is required are rare (and can be worked around by exposing them in the test itself).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants