alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
29.44k stars 12.66k forks source link

nacos kubernetesspring boot application config and register failed #12241

Closed nzb15555196162 closed 1 day ago

nzb15555196162 commented 2 weeks ago

Describe the bug In the kubernetes environment, the springboot application uses nacos as the configuration center and registration center exception Expected behavior In the kubernetes environment, the springboot application uses nacos as the configuration center and registration center ok

Actually behavior In the kubernetes environment, the springboot application uses nacos as the configuration center and registration center exception

How to Reproduce see my below screenshot in kubernetes: 1 1 2 2 when i remove nacos configuration in kubernetes 1 2 3 local start 1 2

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

KomachiSion commented 1 week ago

it's not nacos' problem I think. you should check your application can read the init bootstrap configuration from k8s

nzb15555196162 commented 6 days ago

it's not nacos' problem I think. you should check your application can read the init bootstrap configuration from k8s

I have shown 3 scenarios

  1. the centos7 kubernetes application obtains the nacos configuration abnormally. The application starts abnormally, which leads to the application registration abnormally. However, the command line obtains the application configuration normally. See my screenshots 2

  2. the centos7 kubernetes application removes the nacos configuration function. The application obtains the configuration from the configuration file. The application starts normally and registers nacos

  3. the windows application obtains the nacos configuration normally, starts normally and registers to nacos Through my verification, the problem is a problem with centos kubernetes nacos. The problem lies in the application obtaining the nacos configuration.

KomachiSion commented 5 days ago

From you description, I think it's your application problem. When you application deploy with k8s, it will not read configuration from nacos, but use local config, or when it get config during starting, the network is not well, and waiting the application end, the pod ready and network well.

I suggest you to see the nacos-client log ${user.home}/logs/nacos/config.log to see whether get target config and whether with error.

nzb15555196162 commented 1 day ago

From you description, I think it's your application problem. When you application deploy with k8s, it will not read configuration from nacos, but use local config, or when it get config during starting, the network is not well, and waiting the application end, the pod ready and network well.

I suggest you to see the nacos-client log ${user.home}/logs/nacos/config.log to see whether get target config and whether with error. It should be closed now, because everything is ok with the new kubernetes cluster