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

q7solyqu  于 2022-12-17  发布在  Kubernetes
关注(0)|答案(1)|浏览(116)

Kubernetes中的LoadBalancer服务无法获取ELB外部IP地址,因为其处于挂起状态。
当立即创建时,它不会显示任何事件日志,但在一段时间后,它会给予以下错误:
同步负载平衡器时出错:无法在清理前检查负载平衡器是否存在:无凭据提供程序:链中没有有效的提供程序。已弃用。有关详细消息,请参阅aws.Config.CredentialsChainVerboseErrors
我定义如下,

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

但是,上面的定义适用于不同的集群,并且在创建后立即提供elb端点。
我已经检查了负载平衡器限制和弹性(静态)IP限制,但它有容量。此外,还有两个其他的负载平衡器服务与elb端点之前创建。
问题出在哪里?

j5fpnvbx

j5fpnvbx1#

问题出在群集角色的信任关系中,该角色不具有以下内容,

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

相关问题