是否可以创建一个Cloudfromation模板部署到AWS EKS上?

问题描述 投票:0回答:1

我的意思是,我有一个应用已经被docker化了,我可以提供一个cloudformation模板来部署在客户的EKS集群上吗?

amazon-cloudformation amazon-eks
1个回答
0
投票

我使用Cloudformation已经有一段时间了,然而我从来没有用它来部署Kubernetes构件(到目前为止,我从来没有听说过其他人使用过)。我认为有一种方法可以做到这一点(参见 AWS博客)但即使这个解决方案似乎也是基于Helm的。

我肯定会建议在你的用例中使用Helm图表。Helm图表是直接的,易于使用,特别是当你已经知道你要部署的Kubernetes对象时。


0
投票

你可以使用cdk8s.io。这里有一些例子。https:/github.comawslabscdk8streemasterexamples。


0
投票

部署亚马逊EKS集群,使用 模块化和可扩展的亚马逊 EKS 架构快速启动. 在部署Amazon EKS集群后,在 "输出 "选项卡上,注意到以下输出。

  • HelmLambdaArn
  • KubeClusterName
  • KubeConfigPath
  • KubeGetLambdaArn

下面的模板安装了 WordPress舵手图 就像你登录Kubernetes集群并运行以下命令一样。

helm install stablewordpress

模板的以下部分展示了如何使用Helm来部署WordPress。它还创建了一个负载平衡器主机名,以便您可以访问WordPress网站。

Resources:
  HelmExample:
    Type: "Custom::Helm"
    Version: '1.0'
    Description: 'This deploys the Helm Chart to deploy wordpress in to the EKS Cluster.'
    Properties:
      ServiceToken: !Ref HelmLambdaArn
      KubeConfigPath: !Ref KubeConfigPath
      KubeConfigKmsContext: !Ref KubeConfigKmsContext
      KubeClusterName: !Ref KubeClusterName
      Namespace: !Ref Namespace
      Chart: stable/wordpress
      Name: !Ref Name
      Values:
        wordpressUsername: !Ref wordpressUsername
        wordpressPassword: !Ref wordpressPassword
  WPElbHostName:
    DependsOn: HelmExample
    Type: "Custom::KubeGet"
    Version: '1.0'
    Properties:
     ServiceToken: !Ref KubeGetLambdaArn
     KubeConfigPath: !Ref KubeConfigPath
     KubeConfigKmsContext: !Ref KubeConfigKmsContext
     Namespace: !Ref Namespace
     Name: !Sub 'service/${Name}-wordpress'
     JsonPath: '{.status.loadBalancer.ingress[0].hostname}'

修改Helm图表以适合你的应用,并使用你之前从输出中得到的值修改cloudformation模板,这些是你在部署cloudformation模板时必须填写的参数。

  • HelmLambdaArn
  • KubeClusterName
  • KubeConfigPath
  • KubeGetLambdaArn
  • 命名空间
  • 名称
© www.soinside.com 2019 - 2024. All rights reserved.