通过vertx-config-kubernetes-configmap

时间:2019-09-27 07:53:58

标签: kubernetes configuration vert.x configmap

我正在跟踪https://vertx.io/docs/vertx-config/java/#_kubernetes_configmap_store中的示例,并尝试从配置映射中读取配置。不幸的是,我在尝试时遇到以下问题:

  

严重:扫描配置时出错   io.vertx.core.file.FileSystemException:   java.nio.file.NoSuchFileException:   /var/run/secrets/kubernetes.io/serviceaccount/token           在io.vertx.core.file.impl.FileSystemImpl $ 16.perform(FileSystemImpl.java:869)           在io.vertx.core.file.impl.FileSystemImpl $ 16.perform(FileSystemImpl.java:861)           在io.vertx.core.file.impl.FileSystemImpl $ BlockingAction.handle(FileSystemImpl.java:974)           在io.vertx.core.file.impl.FileSystemImpl $ BlockingAction.handle(FileSystemImpl.java:955)           在io.vertx.core.impl.ContextImpl.lambda $ executeBlocking $ 2(ContextImpl.java:316)           在io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)           在java.base / java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)           在java.base / java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:628)           在io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)           在java.base / java.lang.Thread.run(Thread.java:834)造成原因:java.nio.file.NoSuchFileException:   /var/run/secrets/kubernetes.io/serviceaccount/token           在java.base / sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)           在java.base / sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)           在java.base / sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)           在java.base / sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:215)           在java.base / java.nio.file.Files.newByteChannel(Files.java:370)           在java.base / java.nio.file.Files.newByteChannel(Files.java:421)           在java.base / java.nio.file.Files.readAllBytes(Files.java:3205)           在io.vertx.core.file.impl.FileSystemImpl $ 16.perform(FileSystemImpl.java:865)           ...还有9个

我试图通过设置KUBECONFIG env从minikube或远程Kubernetes集群中读取。

发生了我需要指定token键,例如

ConfigStoreOptions kubernetesStore = new ConfigStoreOptions()
            .setType("configmap")
            .setConfig(new JsonObject()
                    .put("optional", false)
                    .put("token", "some-token")
                    .put("key", "data")
                    .put("name", "metaname")
            );

但是我确实要面对这个问题:

  

严重:扫描配置时出错   java.lang.NullPointerException:不接受任何空主机           在java.base / java.util.Objects.requireNonNull(Objects.java:246)           在io.vertx.core.http.impl.HttpClientImpl.createRequest(HttpClientImpl.java:1080)           在io.vertx.core.http.impl.HttpClientImpl.createRequest(HttpClientImpl.java:1074)           在io.vertx.core.http.impl.HttpClientImpl.request(HttpClientImpl.java:591)           在io.vertx.ext.web.client.impl.HttpContext.handlePrepareRequest(HttpContext.java:339)           在io.vertx.ext.web.client.impl.HttpContext.execute(HttpContext.java:283)           在io.vertx.ext.web.client.impl.HttpContext.next(HttpContext.java:270)           在io.vertx.ext.web.client.impl.predicate.PredicateInterceptor.handle(PredicateInterceptor.java:69)           在io.vertx.ext.web.client.impl.predicate.PredicateInterceptor.handle(PredicateInterceptor.java:32)           在io.vertx.ext.web.client.impl.HttpContext.next(HttpContext.java:267)           在io.vertx.ext.web.client.impl.HttpContext.fire(HttpContext.java:277)           在io.vertx.ext.web.client.impl.HttpContext.prepareRequest(HttpContext.java:166)           在io.vertx.ext.web.client.impl.HttpRequestImpl.send(HttpRequestImpl.java:290)           在io.vertx.ext.web.client.impl.HttpRequestImpl.send(HttpRequestImpl.java:260)           在io.vertx.config.kubernetes.ConfigMapStore.lambda $ getOnContext $ 4(ConfigMapStore.java:192)           在io.vertx.core.Future.lambda $ compose $ 1(Future.java:291)           在io.vertx.core.impl.SucceededFuture.setHandler(SucceededFuture.java:41)           在io.vertx.core.Future.compose(Future.java:287)           在io.vertx.config.kubernetes.ConfigMapStore.getOnContext(ConfigMapStore.java:176)           在io.vertx.config.kubernetes.ConfigMapStore.lambda $ get $ 2(ConfigMapStore.java:164)           在io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:369)           在io.vertx.core.impl.EventLoopContext.lambda $ executeAsync $ 0(EventLoopContext.java:38)           在io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)           在io.netty.util.concurrent.SingleThreadEventExecutor.runAllTask​​s(SingleThreadEventExecutor.java:416)           在io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:515)           在io.netty.util.concurrent.SingleThreadEventExecutor $ 5.run(SingleThreadEventExecutor.java:918)           在io.netty.util.internal.ThreadExecutorMap $ 2.run(ThreadExecutorMap.java:74)           在io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)           在java.base / java.lang.Thread.run(Thread.java:834)

我的问题是我是否缺少某些东西,或者文档建议的用法缺少某些信息? Fabric8 Kubernetes客户端可以在我的机器上正常工作。

谢谢。

0 个答案:

没有答案