spring-cloud / spring-cloud-kubernetes Goto Github PK
View Code? Open in Web Editor NEWKubernetes integration with Spring Cloud Discovery Client, Configuration, etc...
License: Apache License 2.0
Kubernetes integration with Spring Cloud Discovery Client, Configuration, etc...
License: Apache License 2.0
//// DO NOT EDIT THIS FILE. IT WAS GENERATED. Manual changes to this file will be lost when it is generated again. Edit the files in the src/main/asciidoc/ directory instead. ////
The links to the iPaas Quickstarts - Spring Boot - Ribbon are invalid now.
They should be updated to the fabric8-quickstarts/spring-boot-ribbon project I believe.
Reference to https://github.com/spring-cloud-incubator/spring-cloud-kubernetes#propertysource-reload
Git can send notification to a URL but we want to have multiple config servers for high-availability. One option is to put them in a K8S service but then we need to build something in K8S to send notifications to all pods in the service.
Since this is the current release, we could release 0.X.X releases against the camden dependencies.
See #18
When the Arquillian Integration Test is executed, hundred of lines are reported with DEBUG level about Hibernate Validator
cd spring-cloud-kubernetes/spring-cloud-kubernetes-examples/kubernetes-hello-world-example
mvn clean install -Pintegration
17:57:32.192 [main] DEBUG org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver - Cannot find javax.persistence.Persistence on classpath. Assuming non JPA 2 environment. All properties will per default be traversable.
17:57:32.192 [main] DEBUG org.hibernate.validator.internal.xml.ValidationXmlParser - Trying to load META-INF/validation.xml for XML based Validator configuration.
17:57:32.192 [main] DEBUG org.hibernate.validator.internal.xml.ResourceLoaderHelper - Trying to load META-INF/validation.xml via TCCL
17:57:32.192 [main] DEBUG org.hibernate.validator.internal.xml.ResourceLoaderHelper - Trying to load META-INF/validation.xml via Hibernate Validator's class loader
...
This problem can be solved by adding within the logback.xml file the info level for hibernate validator
publish to repo.spring.io
'Copyright 201x-201x the original author or authors.'
This will help having a consistent format, effortless for all IDEs.
It will also help reviewing too.
What is the order of Kubernetes PropertySource with respect to the application's application.yml/bootstrap.yml
files and config service? This should be documented in the README.
Add a Java Junit Test case containing a SpringBoot application exposing a HTTP APi where the message is found from the Kubernetes ConfigMap deployed within a KubernetesMock Server
When the Service resource yaml is generated for the Spring Cloud Kubernetes Reload example using f-m-p and deployed on Kubernetes (using minikube)
mvn clean package fabric8:deploy -Pkubernetes -Dfabric8.generator.from=fabric8/java-alpine-openjdk8-jdk:1.2.3
...
This error is reported
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.2.28:deploy (default-cli) on project spring-cloud-kubernetes-reload: Failed to create Service from kubernetes.yml. io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://192.168.99.100:8443/api/v1/namespaces/default/services. Message: Service "spring-cloud-kubernetes-" is invalid: metadata.name: Invalid value: "spring-cloud-kubernetes-": must match the regex [a-z]([-a-z0-9]*[a-z0-9])? (e.g. 'my-name' or 'abc-123').
as the Service name has been truncated by fmp as it is longer as 24 chars
The workaround is to define a shorter name and pass it within the tag of the fmp configuration
<configuration>
<enricher>
<config>
<fmp-service>
<name>spring-cloud-reload</name>
</fmp-service>
</config>
</enricher>
</configuration>
Such a modification must be done for the Deployment resource too
message: Deployment.extensions "spring-cloud-kubernetes-" is invalid: metadata.name: Invalid value: "spring-cloud-kubernetes-": must match the regex [a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)* (e.g. 'example.com').
ConfigMap deployed on Kubernetes
kubectl get configmap
NAME DATA AGE
reload-example 1 6h
dabou-macosx:~/Code/spring/spring-cloud/spring-cloud-kubernetes-fk/spring-cloud-kubernetes-examples/kubernetes-reload-example$ kubectl get configmap/reload-example -o yaml
apiVersion: v1
data:
application.properties: |-
bean.message=Bonjour le monde!
another.property=value
kind: ConfigMap
metadata:
creationTimestamp: 2017-03-30T12:47:53Z
name: reload-example
namespace: default
resourceVersion: "37260"
selfLink: /api/v1/namespaces/default/configmaps/reload-example
uid: 1756edbd-1547-11e7-ae4e-080027bbcfe9
Log of the spring boot application "Spring Cloud Kubernetes Reload example"
2017-03-30 18:37:40.650 INFO 1 --- [ main] o.s.cloud.kubernetes.examples.App : No active profile set, falling back to default profiles: default
2017-03-30 18:37:40.694 INFO 1 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@79e18e38: startup date [Thu Mar 30 18:37:40 GMT 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@9ef8eb7
2017-03-30 18:37:42.765 WARN 1 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2017-03-30 18:37:42.945 INFO 1 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=ac16cd57-f6aa-308e-985b-b1f02f8063d6
2017-03-30 18:37:43.111 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$da1ed6be] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-30 18:37:44.023 INFO 1 --- [ main] org.xnio : XNIO version 3.3.6.Final
2017-03-30 18:37:44.106 INFO 1 --- [ main] org.xnio.nio : XNIO NIO Implementation Version 3.3.6.Final
2017-03-30 18:37:44.257 WARN 1 --- [ main] io.undertow.websockets.jsr : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
2017-03-30 18:37:44.257 WARN 1 --- [ main] io.undertow.websockets.jsr : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2017-03-30 18:37:44.307 INFO 1 --- [ main] io.undertow.servlet : Initializing Spring embedded WebApplicationContext
2017-03-30 18:37:44.309 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3615 ms
2017-03-30 18:37:44.674 INFO 1 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-03-30 18:37:44.700 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-03-30 18:37:44.706 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-03-30 18:37:44.710 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-03-30 18:37:44.713 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-03-30 18:37:45.632 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@79e18e38: startup date [Thu Mar 30 18:37:40 GMT 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@9ef8eb7
2017-03-30 18:37:45.805 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-03-30 18:37:45.809 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-03-30 18:37:45.871 INFO 1 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-03-30 18:37:45.873 INFO 1 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-03-30 18:37:46.007 INFO 1 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-03-30 18:37:47.374 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-03-30 18:37:47.408 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2017-03-30 18:37:47.410 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'refreshScope' has been autodetected for JMX exposure
2017-03-30 18:37:47.413 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'environmentManager' has been autodetected for JMX exposure
2017-03-30 18:37:47.419 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2017-03-30 18:37:47.465 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2017-03-30 18:37:47.518 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=79e18e38,type=ConfigurationPropertiesRebinder]
2017-03-30 18:37:47.663 INFO 1 --- [ main] s.a.ScheduledAnnotationBeanPostProcessor : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
The message is: a message that can be changed live
2017-03-30 18:37:47.786 INFO 1 --- [ main] b.c.e.u.UndertowEmbeddedServletContainer : Undertow started on port(s) 8080 (http)
2017-03-30 18:37:47.816 INFO 1 --- [ main] o.s.cloud.kubernetes.examples.App : Started App in 12.803 seconds (JVM running for 16.703)
The message is: a message that can be changed live
The message is: a message that can be changed live
The message is: a message that can be changed live
The message is: a message that can be changed live
The message is: a message that can be changed live
Currently getMetadata() in KubernetesServiceInstance returns
Collections.EMPTY_MAP
But other libraries like the axon-distributed-commandbus-springcloud use Metadata to store information like load factor. (SpringCloudCommandRouter.java)
It would be great if there would be some kind of support for those use cases.
and the whole spring-cloud-kubernetes-compat module
When we deploy the kubernetes-hello-world-example
on minikube or minishift, the springboot application is well started BUT if the configMap is modified then the bean message is not reloaded
Options used
spring.application.name=reload-example
spring.cloud.kubernetes.reload.enabled=true
spring.cloud.kubernetes.reload.mode=event
spring.cloud.kubernetes.reload.strategy=restart_context
Scenario played
mvn clean install fabric8:build fabric8:deploy
oc policy add-role-to-user view --serviceaccount=default
oc logs spring-cloud-reload-2-b1bke
The message is: Hello World 2!
2017-05-02 12:11:36.907 INFO 1 --- [ main] b.c.e.u.UndertowEmbeddedServletContainer : Undertow started on port(s) 8080 (http)
2017-05-02 12:11:36.918 INFO 1 --- [ main] o.s.cloud.kubernetes.examples.App : Started App in 4.319 seconds (JVM running for 19.026)
The message is: Hello World!
...
oc edit configmap/reload-example
oc logs spring-cloud-reload-2-b1bke
The message is: Hello World!
The message is: Hello World!
The message is: Hello World!
...
As spring-cloud-kubernetes
uses librairies released by the Fabric8
project, that should be great to include within the documentation a table describing How this project is aligned with the Kubernetes API (1.3, 1.4, 1.5, ...) through the Fabric8 Kubernetes Client (= 1.x or 2.x) and Fabric8 Kubernetes Model (= 1.0.x)
[INFO] +- org.springframework.cloud:spring-cloud-kubernetes-core:jar:0.2.0.BUILD-SNAPSHOT:compile
[INFO] | +- io.fabric8:kubernetes-client:jar:2.2.0:compile
[INFO] | | +- io.fabric8:kubernetes-model:jar:1.0.67:compile
Use NodePort instead of ClusterIP to allow to access from the host the service running within the pod
With this change, we can access the service using IP address returned by this command to make a curl request
minikube service kubernetes-hello-world
from Brixton
Start with 0.2.0 since original was 0.1
Move to 1.0.0 when the project graduates from spring-cloud-incubator
I've been using 0.2.0.BUILD-SNAPSHOT for a couple of weeks without issue. As of this morning, I can successfully build my apps with the starter, but cannot run them. Very early in bootstrap I get the following exception:
10:17:38.391 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client from Kubernetes config...
10:17:38.403 [main] DEBUG io.fabric8.kubernetes.client.Config - Found for Kubernetes config at: [/Users/me/.kube/config].
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationContextInitializer : org.springframework.cloud.kubernetes.profile.KubernetesApplicationContextInitializer
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:423)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:402)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:393)
at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:260)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:236)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
at com.boundlessgeo.bcs.edge.EdgeApplication.main(EdgeApplication.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.kubernetes.profile.KubernetesApplicationContextInitializer]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: okhttp3.OkHttpClient$Builder.pingInterval(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:419)
... 12 more
Caused by: java.lang.NoSuchMethodError: okhttp3.OkHttpClient$Builder.pingInterval(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;
at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:115)
at io.fabric8.kubernetes.client.BaseClient.<init>(BaseClient.java:45)
at io.fabric8.kubernetes.client.BaseClient.<init>(BaseClient.java:37)
at io.fabric8.kubernetes.client.DefaultKubernetesClient.<init>(DefaultKubernetesClient.java:108)
at org.springframework.cloud.kubernetes.profile.KubernetesApplicationContextInitializer.<init>(KubernetesApplicationContextInitializer.java:35)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
... 13 more
Process finished with exit code 1
This error occurs both locally and on kubernetes.
This error is reported when we try to execute the Arquillian Integration test using OpenShift deployed on minishift
[INFO] F8: Found tag on ImageStream kubernetes-hello-world tag: sha256:fd8cc4049fe608a7847a8f4e05490569f11c943f48aa66bdbba5fca2b9c3c481
[INFO] F8: ImageStream kubernetes-hello-world written to /Users/chmoulli/Code/spring/spring-cloud-projects/spring-cloud-kubernetes/spring-cloud-kubernetes-examples/kubernetes-hello-world-example/target/kubernetes-hello-world-is.yml
[INFO]
[INFO] --- maven-failsafe-plugin:2.19.1:integration-test (default) @ kubernetes-hello-world ---
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.springframework.cloud.kubernetes.examples.HelloWorldIT
Initializing Session:a25c0598-790e-4ec9-87f7-c147354ffa60
Using Kubernetes at: https://192.168.64.25:8443/
Creating kubernetes resources inside namespace: itest-a25c0598-790e-4ec9-87f7-c147354ffa60
if you use OpenShift then type this switch namespaces: oc project itest-a25c0598-790e-4ec9-87f7-c147354ffa60
if you use kubernetes then type this to switch namespaces: kubectl config set-context `kubectl config current-context` --namespace=itest-a25c0598-790e-4ec9-87f7-c147354ffa60
Mar 24, 2017 6:04:29 PM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed
WARNING: Failed downloading org/springframework/cloud/spring-cloud-build/1.2.2.BUILD-SNAPSHOT/maven-metadata.xml from http://repo1.maven.org/maven2/. Reason:
org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.springframework.cloud:spring-cloud-build:1.2.2.BUILD-SNAPSHOT/maven-metadata.xml in central (http://repo1.maven.org/maven2)
Applying kubernetes configuration from: jar:file:/Users/chmoulli/Code/spring/spring-cloud-projects/spring-cloud-kubernetes/spring-cloud-kubernetes-examples/kubernetes-hello-world-example/target/kubernetes-hello-world-0.2.0.BUILD-SNAPSHOT.jar!/META-INF/fabric8/kubernetes.json
The are resources in not ready state.
Deployment name: kubernetes-hello-world namespace:itest-a25c0598-790e-4ec9-87f7-c147354ffa60
2017-03-24 18:06:02.689 WARN --- [.64.25:8443/...] i.f.k.c.d.i.WatchConnectionManager : Ignoring onClose for already closed/closing websocket
2017-03-24 18:06:02.689 WARN --- [.64.25:8443/...] i.f.k.c.d.i.WatchConnectionManager : Ignoring onClose for already closed/closing websocket
2017-03-24 18:06:02.689 WARN --- [.64.25:8443/...] i.f.k.c.d.i.WatchConnectionManager : Ignoring onClose for already closed/closing websocket
2017-03-24 18:06:02.689 WARN --- [.64.25:8443/...] i.f.k.c.d.i.WatchConnectionManager : Ignoring onClose for already closed/closing websocket
2017-03-24 18:06:02.689 WARN --- [.64.25:8443/...] i.f.k.c.d.i.WatchConnectionManager : Ignoring onClose for already closed/closing websocket
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 97.542 sec <<< FAILURE! - in org.springframework.cloud.kubernetes.examples.HelloWorldIT
org.springframework.cloud.kubernetes.examples.HelloWorldIT Time elapsed: 97.542 sec <<< ERROR!
java.lang.RuntimeException: java.lang.IllegalStateException: Environment not initialized in time.
Caused by: java.lang.IllegalStateException: Environment not initialized in time.
Caused by: io.fabric8.kubernetes.client.KubernetesClientTimeoutException: Timed out waiting for [300000] milliseconds for multiple resources. Resources that are not ready: [Kind:Deployment Name:kubernetes-hello-world Namespace:itest-a25c0598-790e-4ec9-87f7-c147354ffa60]
Results :
Tests in error:
HelloWorldIT.org.springframework.cloud.kubernetes.examples.HelloWorldIT ยป Runtime
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] --- maven-failsafe-plugin:2.19.1:integration-test (run-integration-tests) @ kubernetes-hello-world ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-failsafe-plugin:2.19.1:verify (run-integration-tests) @ kubernetes-hello-world ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:57 min
[INFO] Finished at: 2017-03-24T18:06:05+01:00
[INFO] Final Memory: 65M/664M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:verify (run-integration-tests) on project kubernetes-hello-world: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/chmoulli/Code/spring/spring-cloud-projects/spring-cloud-kubernetes/spring-cloud-kubernetes-examples/kubernetes-hello-world-example/target/failsafe-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
It looks like that the deployment failed or something happened when the rc was created
Environment not initialized in time.
Caused by: io.fabric8.kubernetes.client.KubernetesClientTimeoutException: Timed out waiting for [300000] milliseconds for multiple resources. Resources that are not ready: [Kind:Deployment Name:kubernetes-hello-world Namespace:itest-a25c0598-790e-4ec9-87f7-c147354ffa60]
I hope everyone give me your suggestion, thank you.
In combination with KubernetesDiscoveryClientConfiguration
to allow use of @ConditionalOn*Bean
Spring standard
Add more instructions within README file of HelloWorld :
This error is reported when the SpringBoot pod running the HelloWorld example is started on minikube
2017-03-27 09:49:51.951 WARN 1 --- [nio-8080-exec-1] o.s.cloud.kubernetes.StandardPodUtils : Failed to get pod with name:[kubernetes-hello-world-3308877505-rktsc]. You should look into this if things aren't working as you expect. Are you missing serviceaccount permissions?
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:61) ~[kubernetes-client-2.2.0.jar!/:na]
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:52) ~[kubernetes-client-2.2.0.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:199) ~[kubernetes-client-2.2.0.jar!/:na]
at org.springframework.cloud.kubernetes.StandardPodUtils.internalGetPod(StandardPodUtils.java:61) [spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar!/:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.StandardPodUtils.lambda$new$0(StandardPodUtils.java:45) [spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar!/:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.LazilyInstantiate.swapper(LazilyInstantiate.java:41) ~[spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar!/:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.LazilyInstantiate.lambda$new$0(LazilyInstantiate.java:34) ~[spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar!/:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.LazilyInstantiate.get(LazilyInstantiate.java:29) ~[spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar!/:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.KubernetesHealthIndicator.doHealthCheck(KubernetesHealthIndicator.java:35) ~[spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar!/:0.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:38) ~[spring-boot-actuator-1.4.2.BUILD-SNAPSHOT.jar!/:1.4.2.BUILD-SNAPSHOT]
at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68) ~[spring-boot-actuator-1.4.2.BUILD-SNAPSHOT.jar!/:1.4.2.BUILD-SNAPSHOT]
at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:81) ~[spring-boot-actuator-1.4.2.BUILD-SNAPSHOT.jar!/:1.4.2.BUILD-SNAPSHOT]
at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getHealth(HealthMvcEndpoint.java:166) ~[spring-boot-actuator-1.4.2.BUILD-SNAPSHOT.jar!/:1.4.2.BUILD-SNAPSHOT]
at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(HealthMvcEndpoint.java:140) ~[spring-boot-actuator-1.4.2.BUILD-SNAPSHOT.jar!/:1.4.2.BUILD-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:220) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) ~[spring-webmvc-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) ~[spring-boot-1.4.2.BUILD-SNAPSHOT.jar!/:1.4.2.BUILD-SNAPSHOT]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105) ~[spring-boot-actuator-1.4.2.BUILD-SNAPSHOT.jar!/:1.4.2.BUILD-SNAPSHOT]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:107) ~[spring-boot-actuator-1.4.2.BUILD-SNAPSHOT.jar!/:1.4.2.BUILD-SNAPSHOT]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_121]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_121]
Caused by: javax.net.ssl.SSLException: java.security.ProviderException: java.io.IOException: Only uncompressed point format supported
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) ~[na:1.8.0_121]
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949) ~[na:1.8.0_121]
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1906) ~[na:1.8.0_121]
at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1889) ~[na:1.8.0_121]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1410) ~[na:1.8.0_121]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) ~[na:1.8.0_121]
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:267) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:237) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:148) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:186) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.6.0.jar!/:na]
at io.fabric8.kubernetes.client.utils.HttpClientUtils$2.intercept(HttpClientUtils.java:93) ~[kubernetes-client-2.2.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179) ~[okhttp-3.6.0.jar!/:na]
at okhttp3.RealCall.execute(RealCall.java:63) ~[okhttp-3.6.0.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:237) ~[kubernetes-client-2.2.0.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:232) ~[kubernetes-client-2.2.0.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:228) ~[kubernetes-client-2.2.0.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleGet(BaseOperation.java:711) ~[kubernetes-client-2.2.0.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:192) ~[kubernetes-client-2.2.0.jar!/:na]
... 77 common frames omitted
Caused by: java.security.ProviderException: java.io.IOException: Only uncompressed point format supported
at sun.security.ec.ECKeyPairGenerator.generateKeyPair(ECKeyPairGenerator.java:147) ~[sunec.jar:1.8.0_121]
at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:703) ~[na:1.8.0_121]
at sun.security.ssl.ECDHCrypt.<init>(ECDHCrypt.java:78) ~[na:1.8.0_121]
at sun.security.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:724) ~[na:1.8.0_121]
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:281) ~[na:1.8.0_121]
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026) ~[na:1.8.0_121]
at sun.security.ssl.Handshaker.process_record(Handshaker.java:961) ~[na:1.8.0_121]
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062) ~[na:1.8.0_121]
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) ~[na:1.8.0_121]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) ~[na:1.8.0_121]
... 105 common frames omitted
Caused by: java.io.IOException: Only uncompressed point format supported
at sun.security.util.ECUtil.decodePoint(ECUtil.java:51) ~[na:1.8.0_121]
at sun.security.ec.ECKeyPairGenerator.generateKeyPair(ECKeyPairGenerator.java:139) ~[sunec.jar:1.8.0_121]
... 114 common frames omitted
The deployment of the HelloWorld in minikube generates
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.17.1/minikube-darwin-
amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
minikube start
mvn clean package fabric8:deploy
generates this error
Failed to pull image "cloud/kubernetes-hello-world:snapshot-170324-194007-0653": Error: image cloud/kubernetes-hello-world not found
Error syncing pod, skipping: failed to "StartContainer" for "spring-boot" with ErrImagePull: "Error: image cloud/kubernetes-hello-world not found"
Kubernetes yaml file generated by f-m-p
---
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Service
metadata:
annotations:
fabric8.io/git-commit: 16b4eaf0016aedfb255cce4c5ea4bc4a4a14a7f3
fabric8.io/git-branch: master
prometheus.io/scrape: "true"
prometheus.io/port: "9779"
labels:
expose: "true"
provider: fabric8
project: kubernetes-hello-world
version: 0.2.0.BUILD-SNAPSHOT
group: org.springframework.cloud
name: kubernetes-hello-world
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8080
selector:
project: kubernetes-hello-world
provider: fabric8
group: org.springframework.cloud
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
fabric8.io/git-commit: 16b4eaf0016aedfb255cce4c5ea4bc4a4a14a7f3
fabric8.io/git-branch: master
fabric8.io/metrics-path: dashboard/file/kubernetes-pods.json/?var-project=kubernetes-hello-world&var-version=0.2.0.BUILD-SNAPSHOT
fabric8.io/docs-url: scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-cloud/docs/kubernetes-hello-world/0.2.0.BUILD-SNAPSHOT/spring-cloud-kubernetes/spring-cloud-kubernetes-examples/kubernetes-hello-world
labels:
provider: fabric8
project: kubernetes-hello-world
version: 0.2.0.BUILD-SNAPSHOT
group: org.springframework.cloud
name: kubernetes-hello-world
spec:
replicas: 1
selector:
matchLabels:
project: kubernetes-hello-world
provider: fabric8
group: org.springframework.cloud
template:
metadata:
annotations:
fabric8.io/git-commit: 16b4eaf0016aedfb255cce4c5ea4bc4a4a14a7f3
fabric8.io/git-branch: master
fabric8.io/metrics-path: dashboard/file/kubernetes-pods.json/?var-project=kubernetes-hello-world&var-version=0.2.0.BUILD-SNAPSHOT
fabric8.io/docs-url: scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-cloud/docs/kubernetes-hello-world/0.2.0.BUILD-SNAPSHOT/spring-cloud-kubernetes/spring-cloud-kubernetes-examples/kubernetes-hello-world
labels:
provider: fabric8
project: kubernetes-hello-world
version: 0.2.0.BUILD-SNAPSHOT
group: org.springframework.cloud
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: cloud/kubernetes-hello-world:snapshot-170324-203655-0857
imagePullPolicy: IfNotPresent
name: spring-boot
ports:
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 9779
name: prometheus
protocol: TCP
- containerPort: 8778
name: jolokia
protocol: TCP
readinessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 180
securityContext:
privileged: false
When a SpringBoot application is starter as a pod, I get this error
Starting the Java application using /opt/run-java/run-java.sh ...
exec java -javaagent:/opt/jolokia/jolokia.jar=config=/opt/jolokia/etc/jolokia.properties -cp .:/deployments/* org.jboss.snowdrop.springboot.RestApplication
I> No access restrictor found, access to any MBean is allowed
Jolokia: Agent started with URL https://172.17.0.3:8778/jolokia/
14:44:08.981 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client from Kubernetes config...
14:44:08.990 [main] DEBUG io.fabric8.kubernetes.client.Config - Did not find Kubernetes config at: [/.kube/config]. Ignoring.
14:44:08.990 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client from service account...
14:44:08.990 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account ca cert at: [/var/run/secrets/kubernetes.io/serviceaccount/ca.crt].
14:44:08.993 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account token at: [/var/run/secrets/kubernetes.io/serviceaccount/token].
14:44:08.994 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client namespace from Kubernetes service account namespace path...
14:44:08.994 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account namespace at: [/var/run/secrets/kubernetes.io/serviceaccount/namespace].
2017-03-08 14:44:09.719 WARN 1 --- [ main] o.s.cloud.kubernetes.StandardPodUtils : Failed to get pod with name:[client-3-aw8k3]. You should look into this if things aren't working as you expect. Are you missing serviceaccount permissions?
java.lang.NoSuchMethodError: io.fabric8.kubernetes.client.KubernetesClient.pods()Lio/fabric8/kubernetes/client/dsl/MixedOperation;
at org.springframework.cloud.kubernetes.StandardPodUtils.internalGetPod(StandardPodUtils.java:61) [spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.StandardPodUtils.lambda$new$0(StandardPodUtils.java:45) [spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.LazilyInstantiate.swapper(LazilyInstantiate.java:41) ~[spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.LazilyInstantiate.lambda$new$0(LazilyInstantiate.java:34) ~[spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.LazilyInstantiate.get(LazilyInstantiate.java:29) ~[spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.profile.KubernetesProfileApplicationListener.addKubernetesProfile(KubernetesProfileApplicationListener.java:50) ~[spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar:0.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.kubernetes.profile.KubernetesApplicationContextInitializer.initialize(KubernetesApplicationContextInitializer.java:53) ~[spring-cloud-kubernetes-core-0.2.0.BUILD-SNAPSHOT.jar:0.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:635) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:349) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:138) ~[spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:84) ~[spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:62) ~[spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:68) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:337) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.jboss.snowdrop.springboot.RestApplication.main(RestApplication.java:30) ~[client-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
Here are the dependencies used
[INFO] +- org.springframework.cloud:spring-cloud-kubernetes-ribbon:jar:0.2.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework.cloud:spring-cloud-kubernetes-discovery:jar:0.2.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework.cloud:spring-cloud-kubernetes-core:jar:0.2.0.BUILD-SNAPSHOT:compile
[INFO] | \- io.fabric8:kubernetes-client:jar:1.4.19:compile
[INFO] | +- io.fabric8:kubernetes-model:jar:1.0.63:compile
Hi,
Sorry if I miss it, but I want to use Spring cloud Kubernetes and I didn't find any information on how to integrate it.
The doc said to add it as dependency to my pom.xml, but the code example use a variable as version ${latest.version
(with a missing bracket).
I don't find it in maven central or mvn repository. I only have the old one under the groupId
io.fabric8
I will use the io.fabric8
version 0.1.4
as a fallback but I would like to switch to this version ๐
Thanks
There is a gap with spring-cloud-consul-discovery regarding refresh feature. Spring Cloud Consul Discovery is providing a CatalogWatchDog which is firing HeartBeatEvent instances so listeners can refresh the list of services in case it has been changed.
I have developed a test case in order to check if the key to be used to populate the response message of the rest controller is coming from a Kubernetes ConfigMap which has been created using a MockServer
Here is the code of the class : https://github.com/cmoulliard/spring-cloud-kubernetes/blob/java-testcase/spring-cloud-kubernetes-config/src/test/java/org/springframework/cloud/kubernetes/config/ConfigMapsSpringBootTest.java
Is there a trick that I could use to bootStrap the SpringBoot application after the MockServer has been created & configMap populated ? Otherwise, the test will continue to validate the by default value of the Greeting class which is Hello, World!
and not Hello ConfigMap, World!
2017-05-03 10:00:56.245 INFO 24787 --- [ main] o.s.c.k.config.ConfigMapsSpringBootTest : Started ConfigMapsSpringBootTest in 13.533 seconds (JVM running for 14.425)
2017-05-03 10:00:56.338 INFO 24787 --- [WebServer 62536] okhttp3.mockwebserver.MockWebServer : MockWebServer[62536] starting to accept connections
2017-05-03 10:00:56.633 INFO 24787 --- [127.0.0.1:62537] okhttp3.mockwebserver.MockWebServer : MockWebServer[62536] received request: GET /api/v1/namespaces/config/configmaps HTTP/1.1 and responded: HTTP/1.1 200 OK
2017-05-03 10:00:57.065 INFO 24787 --- [o-auto-1-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-05-03 10:00:57.065 INFO 24787 --- [o-auto-1-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2017-05-03 10:00:57.079 INFO 24787 --- [o-auto-1-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 14 ms
2017-05-03 10:00:57.486 INFO 24787 --- [WebServer 62536] okhttp3.mockwebserver.MockWebServer : MockWebServer[62536] done accepting connections: Socket closed
Tests run: 2, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 15.467 sec - in org.springframework.cloud.kubernetes.config.ConfigMapsSpringBootTest
2017-05-03 10:00:57.490 INFO 24787 --- [ Thread-2] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4e868ef5: startup date [Wed May 03 10:00:53 CEST 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@7749bf93
Results :
Tests run: 2, Failures: 0, Errors: 0, Skipped: 1
It looks like that spring cloud kubernetes is not align anymore with f-m-p
mvn dependency:tree | grep kubernetes
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
[INFO] | +- io.fabric8:spring-cloud-starter-kubernetes-all:jar:0.1.4:compile
[INFO] | | +- io.fabric8:spring-cloud-kubernetes-core:jar:0.1.4:compile
[INFO] | | +- io.fabric8:spring-cloud-kubernetes-discovery:jar:0.1.4:compile
[INFO] | | +- io.fabric8:spring-cloud-kubernetes-archaius:jar:0.1.4:compile
[INFO] | | +- io.fabric8:spring-cloud-kubernetes-ribbon:jar:0.1.4:compile
[INFO] | | +- io.fabric8:spring-cloud-kubernetes-hystrix:jar:0.1.4:compile
[INFO] | | +- io.fabric8:spring-cloud-kubernetes-zipkin:jar:0.1.4:compile
[INFO] | +- io.fabric8:spring-cloud-kubernetes-compat:jar:0.1.4:compile
[INFO] | \- io.fabric8:kubernetes-client:jar:1.4.19:compile
[INFO] | +- io.fabric8:kubernetes-model:jar:1.0.63:compile
So this error is reported during mvn fabric8:resource goal
Caused by: java.lang.TypeNotPresentException: Type io.fabric8.kubernetes.api.model.extensions.StatefulSetBuilder not present
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:90)
at java.lang.Class.getGenericSuperclass(Class.java:777)
at io.fabric8.kubernetes.api.builder.TypedVisitor.getTypeArguments(TypedVisitor.java:47)
at io.fabric8.kubernetes.api.builder.TypedVisitor.getType(TypedVisitor.java:19)
at io.fabric8.kubernetes.api.builder.BaseFluent.canVisit(BaseFluent.java:51)
at io.fabric8.kubernetes.api.builder.BaseFluent.acceptInternal(BaseFluent.java:93)
at io.fabric8.kubernetes.api.builder.BaseFluent.accept(BaseFluent.java:85)
at io.fabric8.kubernetes.api.builder.BaseFluent.accept(BaseFluent.java:11)
at io.fabric8.kubernetes.api.builder.BaseFluent.acceptInternal(BaseFluent.java:91)
at io.fabric8.kubernetes.api.builder.BaseFluent.accept(BaseFluent.java:85)
at io.fabric8.kubernetes.api.builder.BaseFluent.accept(BaseFluent.java:11)
at io.fabric8.kubernetes.api.builder.BaseFluent.acceptInternal(BaseFluent.java:91)
at io.fabric8.kubernetes.api.builder.BaseFluent.accept(BaseFluent.java:85)
at io.fabric8.maven.enricher.standard.ImageEnricher.ensureTemplateSpecsInStatefulSet(ImageEnricher.java:168)
at io.fabric8.maven.enricher.standard.ImageEnricher.ensureTemplateSpecs(ImageEnricher.java:110)
at io.fabric8.maven.enricher.standard.ImageEnricher.addMissingResources(ImageEnricher.java:97)
at io.fabric8.maven.plugin.enricher.EnricherManager$1.apply(EnricherManager.java:112)
at io.fabric8.maven.plugin.enricher.EnricherManager$1.apply(EnricherManager.java:109)
at io.fabric8.maven.plugin.enricher.EnricherManager.loop(EnricherManager.java:212)
at io.fabric8.maven.plugin.enricher.EnricherManager.createDefaultResources(EnricherManager.java:109)
at io.fabric8.maven.plugin.enricher.EnricherManager.createDefaultResources(EnricherManager.java:104)
at io.fabric8.maven.plugin.mojo.build.ResourceMojo.generateAppResources(ResourceMojo.java:407)
at io.fabric8.maven.plugin.mojo.build.ResourceMojo.generateResources(ResourceMojo.java:347)
at io.fabric8.maven.plugin.mojo.build.ResourceMojo.executeInternal(ResourceMojo.java:197)
at io.fabric8.maven.plugin.mojo.AbstractFabric8Mojo.execute(AbstractFabric8Mojo.java:74)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
/cc @iocanel
@value("${spring.application.name:unknown}")
When the project joins the train, that would be a circular dependency.
Create a spring-cloud-kubernetes-dependencies module
We should give mention of where this came from and give credit where credit is due.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.