spring 部署时 kubernetes 上的云数据流错误

spring cloud dataflow on kubernetes error on deploy

我正在开发 spring 云数据流应用程序。我能够 运行 Spring 云数据流服务器与船长 运行ning in Cloud Foundry 。现在我正在尝试 运行 与 kubernetes 集群中的船长 运行ning 相同,并且在部署时出现以下错误,即使我在部署中明确地在环境配置中给出了用户名。

Caused by: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: kubernetes_cluster_url:6443/api/v1/namespaces/pocdev/services?labelSelector=spring-app-id%3Dtest444-pocclient . Service account may have been revoked. services is forbidden: User "system:anonymous" cannot list resource "services" in API group "" in the namespace "poc-dev".

用于 KUBERNETES 部署的 SKIPPER YML

apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: skipper-server
      labels:
        app: skipper-server
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: skipper-server
      template:
        metadata:
          labels:
            app: skipper-server
          annotations:
            kubernetes.io/psp: nonroot
        spec:
          containers:
            - name: skipper-server
              image: <image_location>
              imagePullPolicy: Always
              ports:
                - containerPort: 7577
                  protocol: TCP
              resources:
                limits:
                  cpu: "4"
                  memory: 2Gi
                requests:
                  cpu: 25m
                  memory: 1Gi
              securityContext:
                runAsUser: 99        
              env:
                - name: "SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS_K8S_FABRIC8_MASTER_URL"
                  value: "<kubernetes_master_url>:6443"
                - name: "SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS_K8S_FABRIC8_USERNAME"
                  value: "<user>"
                - name: "SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS_K8S_FABRIC8_PASSWORD"
                  value: "<pwd>"
                - name: "SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS_K8S_FABRIC8_NAMESPACE"
                  value: "<namespace>"
                - name: "SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS_K8S_FABRIC8_TRUST_CERTS"
                  value: "true"
                - name: "SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS_K8S_CREATE_LOAD_BALANCER"
                  value: "true"

完整的堆栈跟踪

Caused by: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: <kubernetes_cluster_url:6443/api/v1/namespaces/pocdev/services?labelSelector=spring-app-id%3Dtest444-pocclient . Service account may have been revoked. services is forbidden: User "system:anonymous" cannot list resource "services" in API group "" in the namespace "poc-dev".     at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:476) ~[kubernetes-client-4.1.0.jar!/:na]      at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:413) ~[kubernetes-client-4.1.0.jar!/:na]
        at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:381) ~[kubernetes-client-4.1.0.jar!/:na]
        at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:344) ~[kubernetes-client-4.1.0.jar!/:na]
        at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:328) ~[kubernetes-client-4.1.0.jar!/:na]
        at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:598) ~[kubernetes-client-4.1.0.jar!/:na]
        at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:63) ~[kubernetes-client-4.1.0.jar!/:na]
        at org.springframework.cloud.deployer.spi.kubernetes.KubernetesAppDeployer.status(KubernetesAppDeployer.java:196) ~[spring-cloud-deployer-kubernetes-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
        at org.springframework.cloud.deployer.spi.kubernetes.KubernetesAppDeployer.deploy(KubernetesAppDeployer.java:103) ~[spring-cloud-deployer-kubernetes-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
        at org.springframework.cloud.skipper.server.deployer.DefaultReleaseManager.install(DefaultReleaseManager.java:115) ~[spring-cloud-skipper-server-core-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
        ... 50 common frames omitted 

当我从 env 属性列表中删除以下属性并且 skipper 开始使用默认服务而不是我的用户帐户时,这个问题得到了修复

  • 姓名:"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS_K8S_FABRIC8_USERNAME" 价值: ”” - 姓名:"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS_K8S_FABRIC8_PASSWORD" 值:“”