简体   繁体   English

Kubernetes LoadBalancer 服务未获取 ELB 外部 IP 地址

[英]Kubernetes LoadBalancer service not getting ELB external IP address

LoadBalancer service in Kubernetes is not getting ELB external IP address as its stuck in pending state. Kubernetes 中的 LoadBalancer 服务无法获取 ELB 外部 IP 地址,因为它处于挂起状态。

When immediately created it doesn't show any event logs but after a certain time it give the following error:立即创建时,它不会显示任何事件日志,但在一定时间后会出现以下错误:

Error syncing load balancer: failed to check if load balancer exists before cleanup: NoCredentialProviders: no valid providers in chain.同步负载均衡器时出错:无法在清理之前检查负载均衡器是否存在:NoCredentialProviders:链中没有有效的提供程序。 Deprecated.已弃用。 For verbose messaging see aws.Config.CredentialsChainVerboseErrors有关详细消息,请参阅 aws.Config.CredentialsChainVerboseErrors

My definition are as follows,我的定义如下,

apiVersion: apps/v1
kind: Deployment
metadata:
    name: sample-graphql-fetcher-srv
    labels:
        app: sample-graphql-fetcher-srv-api
spec:
  replicas: 1 # tells deployment to run how many pods to run
  selector:
    matchLabels:
      app: sample-graphql-fetcher-srv-api
  template:
    metadata:
      labels:
        app: sample-graphql-fetcher-srv-api
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                - amd64
                - arm64
      containers:
      - name: nginx
        image: <ecr_endpoint>/sample-graphql-fetcher-srv:0.2
        ports:
        - name: http
          containerPort: 8080
        imagePullPolicy: Always #IfNotPresent #
        env:
            - name: ENV_VAR
              value: 'Value'
      nodeSelector:
        kubernetes.io/os: linux


---
apiVersion: v1
kind: Service
metadata:
  name: sample-graphql-fetcher-srv-service
spec:
  type: LoadBalancer
  ports:
  - port: 80
    protocol: TCP
    targetPort: 8080
  selector:
    app: sample-graphql-fetcher-srv-api

However the above definition works on a different cluster and it is providing with the elb endpoint immediately after creation.然而,上面的定义适用于不同的集群,它在创建后立即提供 elb 端点。

I have checked the load balancer limits and elastic(static) IP limit but it had capacity.我检查了负载均衡器限制和弹性(静态)IP 限制,但它有容量。 Also there are two other LoadBalancer Services with the elb endpoint that were created before.此外,还有另外两个带有之前创建的 elb 端点的 LoadBalancer 服务。

Where can the problem lie on?问题出在哪里?

Issue was in the Trust relationship in the cluster's role not having the following,问题出在集群角色中的信任关系中,没有以下内容,

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "eks.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM