现象如下:
[root@k8s1 ~]# kubectl get pod NAME READY STATUS RESTARTS AGE eureka-server-65695bbdc8-49b6v 0/1 CrashLoopBackOff 5 4m32s [root@k8s1 ~]# kubectl get pod NAME READY STATUS RESTARTS AGE eureka-server-65695bbdc8-49b6v 0/1 CrashLoopBackOff 5 5m16s
查找原因及解决如下:
[root@k8s1 ~]# kubectl describe pod eureka-server-65695bbdc8-49b6v Name: eureka-server-65695bbdc8-49b6v Namespace: default Priority: 0 Node: k8s3/192.168.180.144 Start Time: Mon, 03 Feb 2020 21:03:24 +0800 Labels: app=eureka-server pod-template-hash=65695bbdc8 Annotations: <none> Status: Running IP: 10.244.2.2 IPs: <none> Controlled By: ReplicaSet/eureka-server-65695bbdc8 Containers: eureka-server: Container ID: docker://0a8de1c10a8bc42aea722d4994f8b53c06820030de30a2c014f6600d7a98d09d Image: 112.124.104.171:1180/topcheer/eureka-server:1.0.1 Image ID: docker-pullable://112.124.104.171:1180/topcheer/eureka-server@sha256:b18dbacbc640c62b64d92f7240af0adcec2c4d9e870c60194d7ce9fa9d1e557c Port: 9010/TCP Host Port: 0/TCP State: Waiting Reason: CrashLoopBackOff Last State: Terminated Reason: Error Exit Code: 1 Started: Mon, 03 Feb 2020 21:07:15 +0800 Finished: Mon, 03 Feb 2020 21:07:22 +0800 Ready: False Restart Count: 5 Environment: <none> Mounts: /var/run/secrets/kubernetes.io/serviceaccount from default-token-tdbtd (ro) Conditions: Type Status Initialized True Ready False ContainersReady False PodScheduled True Volumes: default-token-tdbtd: Type: Secret (a volume populated by a Secret) SecretName: default-token-tdbtd Optional: false QoS Class: BestEffort Node-Selectors: <none> Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s node.kubernetes.io/unreachable:NoExecute for 300s Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 4m30s default-scheduler Successfully assigned default/eureka-server-65695bbdc8-49b6v to k8s3 Normal Pulled 2m21s (x5 over 4m29s) kubelet, k8s3 Container image "112.124.104.171:1180/topcheer/eureka-server:1.0.1" already present on machine Normal Created 2m21s (x5 over 4m28s) kubelet, k8s3 Created container eureka-server Normal Started 2m21s (x5 over 4m28s) kubelet, k8s3 Started container eureka-server Warning BackOff 105s (x10 over 4m6s) kubelet, k8s3 Back-off restarting failed container
[root@k8s1 ~]# kubectl logs eureka-server-65695bbdc8-49b6v 2020-02-03 13:07:18.750 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$2920e78d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.2.4.RELEASE) 2020-02-03 13:07:19.062 INFO 1 --- [ main] c.t.eureka.EurekaServerApplication : No active profile set, falling back to default profiles: default 2020-02-03 13:07:20.402 WARN 1 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format. 2020-02-03 13:07:20.719 INFO 1 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=aab566da-2958-3e79-aa70-5d794b4e315b 2020-02-03 13:07:21.203 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$2920e78d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2020-02-03 13:07:21.621 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9010 (http) 2020-02-03 13:07:21.638 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2020-02-03 13:07:21.639 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.30] 2020-02-03 13:07:21.727 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2020-02-03 13:07:21.728 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2630 ms 2020-02-03 13:07:21.988 WARN 1 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources. 2020-02-03 13:07:21.989 INFO 1 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath. 2020-02-03 13:07:22.018 INFO 1 --- [ main] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@3c73951 2020-02-03 13:07:22.358 ERROR 1 --- [ main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'traceFilterRegistration' defined in class path resource [org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration.class]: Unsatisfied dependency expressed through method 'traceFilterRegistration' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.servlet.Filter' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=httpTraceFilter)} 2020-02-03 13:07:22.405 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2020-02-03 13:07:22.413 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat 2020-02-03 13:07:22.442 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2020-02-03 13:07:22.778 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE] at com.topcheer.eureka.EurekaServerApplication.main(EurekaServerApplication.java:13) [classes!/:0.0.1-SNAPSHOT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
才发现是boot的版本太高了,和boot有冲突。。。
创建的时候默认最新的版本是2.2.4,需要改一下
所有评论(0)