Ports are not assigned correctly #745
Replies: 7 comments
-
Ok, after some search, it seems this is a problem with minikube/kubernetes itself. Any way I ended up doing a simple python script that runs anyway it will be nice if this can be handled by acorn somehow, as too much time was wasted trying to understand all these kubernetes magic just to run a local dev environment. |
Beta Was this translation helpful? Give feedback.
-
Right on. Thanks for opening the issue. There are definitely somethings we can do to improve this. |
Beta Was this translation helpful? Give feedback.
-
Publishing a port makes it accessible outside of the cluster. Is that what you want to accomplish? Seems to me that you might want the db port to only be accessible inside the cluster (by keycloak) and keycloak to be accessible as an http service. Assuming that's the case, you should do the following:
|
Beta Was this translation helpful? Give feedback.
-
Actually this script is for running a local development environment on my machine - and other dev's machines- . Having everything exposed is also needed so we can easily debug, we need to access the DB using DB tools to have better look. |
Beta Was this translation helpful? Give feedback.
-
ok, makes sense. We provide a little guidance here on how to get minikube setup: https://docs.acorn.io/installation/installing#local-development-clusters. Key takeaways are to install the ingress add-on and run I am assuming your set up is minikube using the docker driver. Correct me if I'm wrong. After following those install instructions for minikube, I did a quick test of a modified version of your acornfile. I couldn't run your keycloak image, so here's the modified version I ran:
Image build command:
Run command:
That Output of acorn ps:
One limitation of this: only one app can consume port 5432, so if that port was already used by some other process or if you launched a second instance of the acorn, it would just hang in "pending" indefinitely. After all that, I was able to connect to postgres:
One final note: my "app" service is on hostname rather than an IP because I defined it as "80/http" rather than "80/tcp". This gives us more flexibility in exposing it. If your keycloak service is indeed htttp, consider switching it from "8080/tcp" to "8080/http". |
Beta Was this translation helpful? Give feedback.
-
FWIW, minikube, IMO, is not the easiest desktop k8s distribution to use. If you aren't married to it, try out Docker Desktop or Rancher Desktop. Docker Desktop does run into some licensing issues (not free once you're over a certain size, I think) so keep that in mind. |
Beta Was this translation helpful? Give feedback.
-
Going to convert this to a discussion |
Beta Was this translation helpful? Give feedback.
-
I am kubernetes noob, and currently trying to run a
minikube
cluster on local machine as dependencies for my app, using.I am trying to publish ports 5432 and 8080, hopefully on localhost, or on the cluster IP, but the services are assigned to random ports instead
my acorn file
I run using
acorn run --name qu -p mydb.com:db:5432 -p keycloak:8080 .
but checking the status gives me
and
minikube service list
gives thisI can actually access the DB on
http://192.168.49.2:30185
, but I want to access it on the port that was published !Minikube has the ingress-plugin added already.
What Am I missing ?
Beta Was this translation helpful? Give feedback.
All reactions