首页 > 解决方案 > KubernetesClientException:操作:[list] for kind:[Endpoints] with name: [null] in namespace: [null] failed

问题描述

请询问有关带有 Kubernetes 的 SpringBootAdmin 服务器的问题。

我有一个非常简单的 SpringBootAdmin Server 应用程序如下

@EnableScheduling
@EnableDiscoveryClient
@EnableAdminServer
@EnableConfigServer
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class);
    }

}
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-kubernetes</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui</artifactId>
            <version>2.3.0</version>
        </dependency>

它在本地机器上启动良好。但是,当放到 Kubernetes 环境中时,它会产生:

ERROR [,e6d057e7abaf4a65,e6d057e7abaf4a65,true] 62 --- [   scheduling-1] o.s.c.k.d.KubernetesCatalogWatch         : Error watching Kubernetes Services

io.fabric8.kubernetes.client.KubernetesClientException: Operation: [list]  for kind: [Endpoints]  with name: [null]  in namespace: [null]  failed.
    at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:64) ~[kubernetes-client-4.10.3.jar!/:na]

为什么那些 [null] 请?我确实用过

spring.cloud.kubernetes.config.namespace=my-namespace

请问是什么问题?

谢谢

标签: javaspring-bootkubernetesspring-boot-admin

解决方案


推荐阅读