简体   繁体   English

Azure Kubernetes 服务 (AKS) 和主节点池

[英]Azure Kubernetes Service (AKS) and the primary node pool

Foreword前言

When you create a Kubernetes cluster on AKS you specify the type of VMs you want to use for your nodes ( --node-vm-size ).在 AKS 上创建 Kubernetes 集群时,您可以指定要用于节点的 VM 类型 ( --node-vm-size )。 I read that you can't change this after you create the Kubernetes cluster, which would mean that you'd be scaling vertically instead of horizontally whenever you add resources.我读到您在创建 Kubernetes 集群后无法更改此设置,这意味着无论何时添加资源,您都将进行垂直扩展而不是水平扩展。

However, you can create different node pools in an AKS cluster that use different types of VMs for your nodes.但是,您可以在 AKS 群集中创建不同的节点池,为您的节点使用不同类型的 VM。 So, I thought, if you want to "change" the type of VM that you chose initially, maybe add a new node pool and remove the old one ("nodepool1")?所以,我想,如果您想“更改”最初选择的 VM 类型,是否可以添加一个新节点池并删除旧节点池(“nodepool1”)?

I tried that through the following steps:我通过以下步骤尝试过:

  • Create a node pool named "stda1v2" with a VM type of "Standard_A1_v2"创建一个名为“stda1v2”的节点池,虚拟机类型为“Standard_A1_v2”
  • Delete "nodepool1" ( az aks nodepool delete --cluster-name ... -g ... -n nodepool1删除“nodepool1”( az aks nodepool delete --cluster-name ... -g ... -n nodepool1

Unfortunately I was met with Primary agentpool cannot be deleted .不幸的是我遇到了Primary agentpool cannot be deleted

Question

What is the purpose of the "primary agentpool" which cannot be deleted, and does it matter (a lot) what type of VM I choose when I create the AKS cluster (in a real world scenario)?无法删除的“主代理池”的目的是什么,当我创建 AKS 集群时(在现实世界的场景中),我选择什么类型的 VM 很重要吗?

Can I create other node pools and let the primary one live its life?我可以创建其他节点池并让主要节点继续其生命吗? Will it cause trouble in the future if I have node pools that use larger VMs for its nodes but the primary one still using "Standard_A1_v2" for example?例如,如果我的节点池使用更大的 VM 作为其节点,但主要节点仍然使用“Standard_A1_v2”,它会不会在将来造成麻烦?

Primary node pool is the first nodepool in the cluster and you cannot delete it, because its currently not supported.主节点池是集群中的第一个节点池,您不能删除它,因为它目前不受支持。 You can create and delete additional node pools and just let primary be as it is.您可以创建和删除其他节点池,让主要节点保持原样。 It will not create any trouble.它不会造成任何麻烦。

For the primary node pool I suggest picking a VM size that makes more sense in a long run (since you cannot change it).对于主节点池,我建议选择从长远来看更有意义的 VM 大小(因为您无法更改它)。 B-series would be a good fit, since they are cheap and CPU\\mem ratio is good for average workloads. B 系列将是一个不错的选择,因为它们很便宜,而且 CPU\\mem 比率适合平均工作负载。

ps.附: You can always scale primary node pool to 0 nodes, cordon the node and shut it down.您始终可以将主节点池扩展到 0 个节点,封锁该节点并将其关闭。 You will have to repeat this post upgrade, but otherwise it will work您将不得不重复此后升级,否则它将起作用

It looks like this functionality was introduced around the time of your question, allowing you to add new system nodepools and delete old ones, including the initial nodepool.看起来此功能是在您提出问题时引入的,允许您添加新的系统节点池并删除旧的节点池,包括初始节点池。 After encountering the same error message myself while trying to tidy up a cluster, I discovered I had to set another nodepool to a system type in order to delete the first.在尝试整理集群时遇到相同的错误消息后,我发现我必须将另一个节点池设置为系统类型才能删除第一个。

There's more info about it here , but in short, Azure nodepools are split into two types ('modes' as they call it): System and User.有一个关于它的详细信息在这里,但在短期,天青nodepools分成两种类型(“模式”,因为他们称呼它):系统和用户。 When creating a single pool to begin with, it will be of a system type (favouring system pod scheduling -- so it might be good to have a dedicated pool of a node or two for system use, then a second user nodepool for the actual app pods).创建单个池开始时,它将属于系统类型(有利于系统 pod 调度——因此最好有一个或两个节点的专用池供系统使用,然后是第二个用户节点池供实际使用)应用程序荚)。

So if you wish to delete your only system pool, you need to first create another nodepool with the --mode switch set to 'system' (with your preferred VM size etc.), then you'll be able to delete the first (and nodepool modes can't be changed after the fact, only on creation).因此,如果您希望删除唯一的系统池,则需要首先创建另一个节点池,并将 --mode 开关设置为“系统”(使用您首选的 VM 大小等),然后您就可以删除第一个(并且节点池模式不能在事后更改,只能在创建时更改)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM