代码之家  ›  专栏  ›  技术社区  ›  DenCowboy

使用CloudFormation安装EKS和Fargate

  •  1
  • DenCowboy  · 技术社区  · 4 年前

    我能够使用Cloudformation创建EKS集群。我还可以有一个“节点组”和EC2+自动缩放。另一方面,我还可以安装FargateProfile并创建“FargateNodes”。这很有效。但我只想使用fargate(没有EC2节点等)。在这里,我需要在Fargate上托管我的管理吊舱(在kube系统中)。我该怎么办?

    我试过这个:

    Resources:
      FargateProfile:
        Type: AWS::EKS::FargateProfile
        Properties:
          ClusterName: eks-test-cluster-001
          FargateProfileName: fargate
          PodExecutionRoleArn: !Sub 'arn:aws:iam::${AWS::AccountId}:role/AmazonEKSFargatePodExecutionRole'
          Selectors:
            - Namespace: kube-system
            - Namespace: default
            - Namespace: xxx
          Subnets:
            !Ref Subnets
    

    但我的管理吊舱仍在EC2上。也许我丢失了一些标签,但这是正确的方法吗?有些标签是用散列生成的,所以我不能只在fargateProfile中添加它们。

    有了eksctl,这似乎是可能的:在上面的命令中添加--fargate选项将创建一个没有节点组的集群。但是,eksctl创建了一个pod执行角色,一个默认和kube系统名称空间的Fargate配置文件,并对coredns部署进行了修补,以便它可以在Fargate上运行。

    我也尝试了使用cloudan模型 validation failed (#: extraneous key [k8s-app] is not permitted)

    0 回复  |  直到 4 年前
        1
  •  0
  •   Tao Tao    4 年前

    我没有复制这个模板。 价值:XXX

        2
  •  -1
  •   Amit Katyal    4 年前

    Resources:
      FargateProfile:
        Type: 'AWS::EKS::FargateProfile'
        DependsOn: ControlPlane
        Properties:
          ClusterName: my-cluster
          FargateProfileName: fp-default
          PodExecutionRoleArn: !GetAtt 
            - FargatePodExecutionRole
            - Arn
          Selectors:
            - Namespace: default
            - Namespace: kube-system
              Labels:
                - Key: k8s-app
                  Value: kube-dns