terraform实例_使用Terraform用graviton2实例构建Amazon eks集群

terraform实例

Last week AWS announced the general availability of AWS Graviton2 instances for Amazon Elastic Kubernetes Services (EKS), allowing the deployment of production workloads using Arm-based instances. At the time of writing, the newest generation of EC2 instances powered by Graviton2 Arm processors deliver up to 40% better price/performance over comparable current generation x86-based instances. This can provide EKS users significant cost-savings for workloads that can take advantage of the Arm processor architecture.

上周,AWS 宣布了适用于Amazon Elastic Kubernetes Services(EKS)的AWS Graviton2实例的一般可用性,从而允许使用基于Arm的实例部署生产工作负载。 在撰写本文时,由Graviton2 Arm处理器提供支持的最新一代EC2实例的价格/性能比同类基于x86的当前实例提高了40%。 这可以为EKS用户节省可利用Arm处理器体系结构的工作量带来的大量成本节省。

TLDR: You can now use Graviton2 instances with EKS, and doing so may save you money. If you’re running any reasonable number of EC2 nodes for your EKS clusters you should consider looking in to the benefits.

TLDR:您现在可以将Graviton2实例与EKS一起使用,这样做可以省钱。 如果您为EKS集群运行任意数量的EC2节点,则应考虑利用这些好处。

In this article we’ll take a look at building an EKS cluster using Terraform that takes advantage of Graviton2 EC2 instances by way of EKS Managed Node Groups. It assumes working knowledge of AWS, EKS and Terraform.

在本文中,我们将介绍如何使用Terraform构建EKS集群,该集群通过EKS受管节点组利用Graviton2 EC2实例。 它假定您具有AWS,EKS和Terraform的工作知识。

A fully working example can be found on GitHub.

一个完整的示例可以在GitHub找到

为什么要使用Terraform? (Why Terraform?)

There are many ways to build an EKS cluster, such as the AWS Console, eksctl, CloudFormation and AWS CDK. Many of these are either maintained by AWS or otherwise promoted (like eksctl), so support already exists along with articles for how to leverage it in various forms.

有多种构建EKS集群的方法,例如AWS控制台,eksctl,CloudFormation和AWS CDK。 其中许多要么由AWS维护,要么通过其他方式进行了推广(例如eksctl),因此,关于如何以各种形式利用它的文章已经存在支持。

In this example we’re going to use Terraform to showcase a contribution I made to the Terraform AWS Provider that’s been released with version 3.3.0 that allows use of Graviton2 instances with EKS Managed Node Groups.

在此示例中,我们将使用Terraform展示我对3.3.0版中发布的Terraform AWS Provider的贡献 ,该版本允许Graviton2实例与EKS受管节点组一起使用。

Kubernetes上的Arm工作量 (Arm Workloads on Kubernetes)

Before jumping in, its worth quickly discussing the concept of running Arm-based workloads on Kubernetes.

在开始之前,值得快速讨论一下在Kubernetes上运行基于Arm的工作负载的概念。

Kubernetes was designed to allow its worker nodes to be made up of heterogeneous machines (virtual or otherwise), meaning that each node can be configured differently. Not only does this provide flexibility in terms of provisioning capacity, it also allows for infrastructure to be provided to fulfill specific use-cases. Common examples of this are nodes that can provide GPU capabilities, or nodes that have more proportional processing power for CPU-bound workloads.

Kubernetes的设计允许其工作节点由异构机器(虚拟或其他)组成,这意味着每个节点的配置都可以不同。 这不仅在配置容量方面提供了灵活性,而且还允许提供基础结构来满足特定的用例。 常见的示例是可以提供GPU功能的节点,或者对CPU约束的工作负载具有更成比例的处理能力的节点。

Although from one perspective Arm nodes are simply providing another hardware configuration on which Kubernetes can schedule workloads, there is some additional complexity introducing a new processor architecture. Until recently, the majority of instance types provided by the main cloud vendors were almost exclusively based on x86 processor architectures. Depending on the technology stack of your workloads, there will be varying degrees of work required in porting code to run on an Arm architecture, as well as building multi-architecture container images.

尽管从一个角度来看,Arm节点只是在提供另一种硬件配置,Kubernetes可以在该硬件配置上调度工作负载,但是引入新的处理器架构会带来一些额外的复杂性。 直到最近,主要云供应商提供的大多数实例类型几乎都完全基于x86处理器体系结构。 根据工作负载的技术堆栈,移植代码以在Arm架构上运行以及构建多架构容器映像时 ,将需要进行不同程度的工作。

The details of this topic are beyond the scope of this article, but AWS have already published a blog post that provides more insight, as well as an example.

该主题的详细信息超出了本文的范围,但是AWS已经发布了一篇博客文章,该文章提供了更多的见解以及示例。

建立集群 (Building the Cluster)

With the support added to the Terraform AWS provider, building a cluster to take advantage of the new Arm-based instances types does not differ significantly from using x86-based instances.

通过添加到Terraform AWS提供程序的支持,构建集群以利用新的基于Arm的实例类型与使用基于x86的实例没有太大区别。

Below is a partial snippet we can review for the relevant configuration. See the linked GitHub repository for a full example.

下面是部分代码片段,我们可以查看相关配置。 有关完整示例,请参见链接的GitHub存储库

The key takeaways of this configuration snippet are:

此配置代码段的主要内容是:

  • The AWS provider version must be at least 3.3.0

    AWS提供程序version必须至少为3.3.0

  • The EKS Node Group should use a Graviton2 instance type (in this case m6g.medium), as must specify the ami_type as AL2_ARM_64.

    EKS节点组应使用m6g.medium实例类型(在本例中为m6g.medium ),因为必须将ami_type指定为AL2_ARM_64

After using Terraform to apply the configuration in the example GitHub repository, we can inspect the Node Group that was created:

在使用Terraform在示例GitHub存储库中应用配置之后,我们可以检查创建的节点组:

Image for post
Node group with Graviton2 Instance type
具有Graviton2实例类型的节点组

The configuration shows that it was successfully created with the Graviton2 instance type that we specified.

配置显示它已使用我们指定的Graviton2实例类型成功创建。

The EC2 Console show an additional level of detail regarding the specific instances that were provisioned by the Node Group:

EC2控制台显示了有关节点组所配置的特定实例的更多详细信息:

Image for post
Graviton2 EC2 instances
Graviton2 EC2实例

EKS automatically configures the appropriate Arm-compatible AMI to use for these EC2 instances.

EKS自动配置适当的与Arm兼容的AMI,以用于这些EC2实例。

EKS clusters do not need to use either x86 or Arm nodes exclusively, and there would be no issue creating an additional Node Group that uses the former processor architecture to provide a heterogeneous set of instances that can cater for a variety of workloads.

EKS集群不需要专门使用x86或Arm节点,并且创建一个额外的节点组也没有问题,该节点组使用以前的处理器体系结构来提供可以满足各种工作负载的异构实例集。

结论 (Conclusion)

The AWS Graviton2 instance family represents a really exciting new opportunity to save on AWS compute costs, and this capability has now been unlocked for EKS users. The simple example above illustrates how Terraform users who consume EKS can start to build on top of this new configuration option to migrate their workloads to instances built on Arm processors and cut some costs in the monthly cloud bill.

AWS Graviton2实例家族是节省AWS计算成本的一个非常令人兴奋的新机会,并且此功能现已为EKS用户解锁。 上面的简单示例说明了使用EKS的Terraform用户如何开始在此新配置选项的基础上进行构建,以将其工作负载迁移到基于Arm处理器构建的实例,并削减每月云计算费用。

翻译自: https://medium.com/@niallthomson/building-amazon-eks-clusters-with-graviton2-instances-using-terraform-30cdcaed9e54

terraform实例

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值