quarkus-for-spring-developers / examples

Example code for the Quarkus for Spring Developers eBook
https://red.ht/quarkus-spring-devs
Apache License 2.0
46 stars 17 forks source link

chapter-6-quarkus-rest-cloud-config application failed to start #92

Closed aureamunoz closed 3 years ago

aureamunoz commented 3 years ago

I followed the readme and did some modifications in order to make the ./mvnw clean package pass, see https://github.com/quarkus-for-spring-developers/examples/pull/93

1 - Add the ingress resource in the src/main/k8s/helm.yml file (remove the commented part)

#
# Helm chart to install the Spring Cloud Config server
# Commands to be executed
# kubectl create ns config-storage
# helm install \
#    spring-cloud-config-server kiwigrid/spring-cloud-config-server \
#    -n config-storage \
#    -f src/main/configs/helm.yml
#
# helm delete spring-cloud-config-server -n config-storage
#
config:
  # gitUri: https://github.com/quarkus-for-spring-developers/examples.git
  gitUri: https://github.com/ch007m/config-repo.git
  gitSearchpath: chapter-6
extraEnv:
  - name: SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT-LABEL
    value: main

ingress:
  enabled: true
  hosts:
    - host: spring-cloud-config.127.0.0.1.nip.io
      paths:
        - /

2- Install the spring cloud config

helm install \
  spring-cloud-config-server kiwigrid/spring-cloud-config-server \
  -n config-storage \
  -f src/main/k8s/helm.yml

3 - Modify the configuration to use the ingress host and port parameter:

quarkus.spring-cloud-config.url=http://spring-cloud-config.127.0.0.1.nip.io:80

4 - Package and deploy the application

./mvnw clean package
kubectl create ns quarkus-demo-cloud-config
kubectl apply -f ./target/kubernetes/kubernetes.yml -n quarkus-demo-cloud-config

The application failed to start with the following logs:


--/ \/ / / / | / \/ //_/ / / / / -/ // / // / |/ , / ,< / // /\ \
--_
__// |//|//||____//
2021-06-23 15:56:58,642 ERROR [io.qua.spr.clo.con.cli.run.SpringCloudConfigServerClientConfigSourceProvider] (main) Unable to obtain configuration from Spring Cloud Config Server at http://spring-cloud-config.127.0.0.1.nip.io:80: java.util.concurrent.CompletionException: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: spring-cloud-config.127.0.0.1.nip.io/127.0.0.1:80 at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:73) at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:61) at io.quarkus.spring.cloud.config.client.runtime.SpringCloudConfigServerClientConfigSourceProvider.getConfigSources(SpringCloudConfigServerClientConfigSourceProvider.java:46) at io.quarkus.runtime.configuration.ConfigUtils.addSourceProvider(ConfigUtils.java:151) at io.quarkus.runtime.configuration.ConfigUtils.addSourceProviders(ConfigUtils.java:165) at io.quarkus.runtime.generated.Config.readConfig(Config.zig:1485) at io.quarkus.deployment.steps.RuntimeConfigSetup.deploy(RuntimeConfigSetup.zig:60) at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:392) at io.quarkus.runtime.Application.start(Application.java:101) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:101) at io.quarkus.runtime.Quarkus.run(Quarkus.java:66) at io.quarkus.runtime.Quarkus.run(Quarkus.java:42) at io.quarkus.runtime.Quarkus.run(Quarkus.java:119) at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:48) at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:25) Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: spring-cloud-config.127.0.0.1.nip.io/127.0.0.1:80 Caused by: java.net.ConnectException: Connection refused at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:779) at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:330) at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:707) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834)

2021-06-23 15:56:58,752 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): io.smallrye.config.ConfigValidationException: Configuration validation failed: java.util.NoSuchElementException: SRCFG00014: The config property greeting.message is required but it could not be found in any config source at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:818) at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:777) at io.smallrye.config.ConfigMappings.mapConfiguration(ConfigMappings.java:54) at io.smallrye.config.ConfigMappings.registerConfigMappings(ConfigMappings.java:36) at io.quarkus.arc.runtime.ConfigRecorder.registerConfigMappings(ConfigRecorder.java:50) at io.quarkus.deployment.steps.ConfigBuildStep$registerConfigClasses-2116437784.deploy_0(ConfigBuildStep$registerConfigClasses-2116437784.zig:132) at io.quarkus.deployment.steps.ConfigBuildStep$registerConfigClasses-2116437784.deploy(ConfigBuildStep$registerConfigClasses-2116437784.zig:40) at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:524) at io.quarkus.runtime.Application.start(Application.java:101) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:101) at io.quarkus.runtime.Quarkus.run(Quarkus.java:66) at io.quarkus.runtime.Quarkus.run(Quarkus.java:42) at io.quarkus.runtime.Quarkus.run(Quarkus.java:119) at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:48) at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:25)

cmoulliard commented 3 years ago

ingress: enabled: true hosts:

  • host: spring-cloud-config.127.0.0.1.nip.io paths:
    • /

It is not needed to uncomment such a section part of the heml.yml file as we will not, as end user, access the SCC server remotely. The SCCS will be accessed by the pod using the internal Kubernetes DNS address.

I will then remove the commented lines of the helm.yml file to avoid the problem