如何使用 eckctl 指定 AWS EKS Fargate 集群的可用区?

时间:2021-02-08 19:48:02

标签: kubernetes amazon-eks eksctl

我正在学习 Kubernetes,并尝试使用以下配置简单文件创建 AWS EKS Fargate 集群

kind: ClusterConfig
apiVersion: eksctl.io/v1alpha5

metadata:
  name: sandbox
  region: us-east-1
  version: "1.18"

fargateProfiles:
  - name: fp-default
    selectors:
      # All workloads in the "default" Kubernetes namespace will be
      # scheduled onto Fargate:
      - namespace: default
      # All workloads in the "kube-system" Kubernetes namespace will be
      # scheduled onto Fargate:
      - namespace: kube-system
  - name: fp-sandbox
    selectors:
      # All workloads in the "sandbox" Kubernetes namespace matching the
      # following label selectors will be scheduled onto Fargate:
      - namespace: sandbox
        labels:
          env: sandbox
          checks: passed
  - name: fp-fluxcd
    selectors:
      # All workloads in the "fluxcd" Kubernetes namespace matching the
      # following label selectors will be scheduled onto Fargate:
      - namespace: fluxcd

我收到以下错误。如何在上述配置文件中指定可用区?

[✖]  AWS::EKS::Cluster/ControlPlane: CREATE_FAILED – "Cannot create cluster 'sandbox' because us-east-1a, the targeted availability zone, does not currently have sufficient capacity to support the cluster. Retry and choose from these availability zones: us-east-1b, us-east-1c, us-east-1d, us-east-1e, us-east-1f (Service: AmazonEKS; Status Code: 400; Error Code: UnsupportedAvailabilityZoneException; Request ID: 7c5c4544-4fe5-4ed5-96a8-099d60e1e5ab; Proxy: null)"

1 个答案:

答案 0 :(得分:0)

请参阅 eksctl config file schema

kind: ClusterConfig
apiVersion: eksctl.io/v1alpha5

metadata:
  name: sandbox
  region: us-east-1
  version: "1.18"

fargateProfiles:
  - name: fp-default
    selectors:
      # All workloads in the "default" Kubernetes namespace will be
      # scheduled onto Fargate:
      - namespace: default
      # All workloads in the "kube-system" Kubernetes namespace will be
      # scheduled onto Fargate:
      - namespace: kube-system
  - name: fp-sandbox
    selectors:
      # All workloads in the "sandbox" Kubernetes namespace matching the
      # following label selectors will be scheduled onto Fargate:
      - namespace: sandbox
        labels:
          env: sandbox
          checks: passed
  - name: fp-fluxcd
    selectors:
      # All workloads in the "fluxcd" Kubernetes namespace matching the
      # following label selectors will be scheduled onto Fargate:
      - namespace: fluxcd

availabilityZones: ['us-east-1b']