-
-
Notifications
You must be signed in to change notification settings - Fork 237
Kubernetes automatically sets KROKI_PORT to tcp://ip:port causing a ClassCastException #576
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
Comments
Hi,
I don't think that Docker will automatically define I guess the workaround is to explicitly define the environment variable
I could add an alias but I don't think that would solve this issue... so that would be a breaking change.
|
https://docs.docker.com/network/links/#environment-variables It's a rarely known feature. In the early days, Kubernetes wants to be docker compatible. Since docker links is deprecated, it might be not happen on docker anymore.
An another idea: kroki could catch the exception here, add a log line like This change is still non breaking, but it provides a "works out of the box setup" on platforms like Kubernetes. |
OH I didn't know that, thanks! Start a container named
Start a Kroki container using a link on the
The |
I was drafting a list of possible solutions including what you suggested: Possible solutionsupdate the environment variable name to avoid conflictsDespite the fact that this is a breaking change, it does not prevent conflicts. I wish Kubernetes/Docker will not pollute environment variables without using a unique prefix... but no 😞 check if the
|
I can confirm it works in Kubernetes. It looks like user provided environment variables will be preferred. I used this workaround to run kroki on our kubernetes.
About about KROKI_LISTEN? Like Since kubernetes use predefined suffixes this will be not conflicted kubernetes anymore. |
Thanks for your input.
That's a good idea, I like it! |
I started experimenting and here's a few edge cases: Default port
It will be equivalent to IPv6Apparently, the notation in this case is to encode the IPv6 IP number in square brackets:
That's RFC 3986, section 3.2.2: Host
So the supported formats are:
Default port: Thoughts? |
As a sysadm, I would expect Taking at look at https://docs.oracle.com/javase/8/docs/technotes/guides/net/ipv6_guide/index.html
I would say I would put |
Interesting...
I was suggesting to use But I guess we can mention in the documentation that I will try to pass What do you think about using square brackets around IPv6? Does it make sense? Is this the way to go?
Thanks for your input! |
I'm still getting this exception on Kubernetes: {"timestamp":"1625589452727","level":"ERROR","thread":"vert.x-eventloop-thread-0","logger":"io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer","message":"Failed in deploying verticle","context":"default","exception":"java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap')\n\tat io.vertx.core.json.JsonObject.getInteger(JsonObject.java:168)\n\tat io.vertx.core.json.JsonObject.getInteger(JsonObject.java:435)\n\tat io.kroki.server.service.Blockdiag.<init>(Blockdiag.java:37)\n\tat io.kroki.server.Server.start(Server.java:104)\n\tat io.kroki.server.Server.lambda$start$1(Server.java:61)\n\tat io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:124)\n\tat io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:62)\n\tat io.vertx.core.impl.future.FutureImpl.addListener(FutureImpl.java:164)\n\tat io.vertx.core.impl.future.FutureImpl.onComplete(FutureImpl.java:132)\n\tat io.vertx.config.impl.ConfigRetrieverImpl.getConfig(ConfigRetrieverImpl.java:175)\n\tat io.kroki.server.Server.start(Server.java:57)\n\tat io.vertx.core.impl.DeploymentManager.lambda$doDeploy$5(DeploymentManager.java:196)\n\tat io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:96)\n\tat io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:59)\n\tat io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:37)\n\tat io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)\n\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.base/java.lang.Thread.run(Unknown Source)\n"} Even though I've set the - name: KROKI_LISTEN
value: "0.0.0.0" Strangely I don't even have a
Is there anything else I need to configure? |
This is not the same issue but it's somehow related:
For reference, here's the line:
It seems that Kubernetes is also interfering with the companion containers... 😞 |
@Mogztter Sure, base on the service Its described here (https://kubernetes.io/docs/concepts/services-networking/service/#environment-variables) for the service redis-master. There are two ways to resolve that issue in general:
@obitech Your workaround would be something like define |
@jkroepke thanks for your quick reply! Setting the ports explicitly via the env vars |
Hi,
i tried to start kroki (0.10 from docker) on out openshift 3.11 (kubernetes 1.11) instance.
The container just raise a ClassCastException on startup. On a local docker environment, everything works fine.
Cause:
Kubernetes (in some situations, Docker, too). Set the en var
KROKI_PORT
totcp://172.30.18.91:8000
if there is a service called kroki inside the same namespace:KROKI_PORT
is also used by kroki itself to define the listing port.I would recommended to change the name to avoid conflicts in the feature, e.g.
KROKI_SERVER_PORT
orKROKI_LISTEN_PORT
.If you, it would great to document this somewhere.
The text was updated successfully, but these errors were encountered: