简介

关联资源标签<font style="color:rgb(24, 24, 24);">是阿里云标签提供的一种产品能力,它基于资源间的关联关系,实现了资源间的标签继承。当您操作主资源标签或主资源与关联资源建立联系时,关联资源可以自动跟随继承主资源的标签变更。开启该功能可以提高运维效率,节省标签管理成本。</font>

<font style="color:rgb(24, 24, 24);">本文介绍了关联资源标签的使用场景、原理及使用步骤,帮助您更高效地通过标签管理资源。</font>

使用场景

<font style="color:rgb(24, 24, 24);">以下用主资源:容器服务</font><font style="color:rgb(51, 51, 51);background-color:rgb(239, 243, 248);">容器服务Kubernetes版集群(ACK)</font><font style="color:rgb(51, 51, 51);">和它的关联资源:</font><font style="color:rgb(51, 51, 51);background-color:rgb(239, 243, 248);">云服务器实例(ECS)</font><font style="color:rgb(51, 51, 51);">为例,介绍关联资源标签的使用场景。</font><font style="color:rgb(24, 24, 24);">例如:用户为ACK集群绑定或解绑标签时,其关联的ECS实例会自动绑定或解绑该标签;用户为ACK集群扩容新的ECS实例节点时,这些新加入的ECS实例可以自动继承ACK集群上的标签。</font>

画板

注意:<font style="color:rgb(51, 51, 51);background-color:rgb(239, 243, 248);">当前功能不覆盖存量关联资源继承存量标签场景,如果需要让功能开启前已有的关联资源继承已有的标签,请前往</font>运维编排OOS控制台创建执行任务

基本原理

画板

标签关联继承的基本原理说明如下:

  1. 用户在标签控制台开启关联资源标签功能,并配置关联资源规则(详见使用步骤),标签服务将用户配置的关联规则持久化。
  2. 用户对主资源、子资源进行绑定/解绑操作,或操作主资源标签时,会产生对应的操作审计事件。
  3. 标签服务监听操作审计事件,结合关联配置进行判断和处理。
  4. 标签服务异步执行对应的标签继承操作。

使用步骤

启用关联资源标签设置功能

  1. <font style="color:rgb(24, 24, 24);">登录</font><font style="color:rgb(24, 24, 24);">标签控制台</font><font style="color:rgb(24, 24, 24);">。在左侧导航栏,选择</font><font style="color:rgb(24, 24, 24);">标签 > 关联资源标签设置</font><font style="color:rgb(24, 24, 24);">。</font>
  2. <font style="color:rgb(24, 24, 24);">阅读启用说明,选中创建服务关联角色。</font>

<font style="color:rgb(24, 24, 24);">启用关联资源标签设置功能时,系统会自动创建一个名为AliyunServiceRoleForTag的服务关联角色,用于执行关联资源标签相关操作。更多信息,请参见</font><font style="color:rgb(24, 24, 24);">标签服务关联角色</font><font style="color:rgb(24, 24, 24);">。</font>

  1. <font style="color:rgb(24, 24, 24);">单击</font><font style="color:rgb(24, 24, 24);">启用并设置规则</font><font style="color:rgb(24, 24, 24);">。</font>
  2. <font style="color:rgb(24, 24, 24);">设置关联资源标签规则。</font>

<font style="color:rgb(24, 24, 24);">针对支持关联资源标签设置功能的资源,指定需要继承的标签键,可以选择全部标签键或部分标签键。</font>

  1. <font style="color:rgb(24, 24, 24);">单击</font><font style="color:rgb(24, 24, 24);">确定</font><font style="color:rgb(24, 24, 24);">。</font>

修改关联资源标签规则

  1. <font style="color:rgb(24, 24, 24);">登录</font><font style="color:rgb(24, 24, 24);">标签控制台</font><font style="color:rgb(24, 24, 24);">。在左侧导航栏,选择</font><font style="color:rgb(24, 24, 24);">标签 > 关联资源标签设置</font><font style="color:rgb(24, 24, 24);">。</font>
  2. <font style="color:rgb(24, 24, 24);">在页面右上角,单击</font><font style="color:rgb(24, 24, 24);">编辑</font><font style="color:rgb(24, 24, 24);">,修改关联资源标签规则。</font>

<font style="color:rgb(24, 24, 24);">针对支持关联资源标签设置功能的资源,指定需要继承的标签键,可以选择全部标签键或部分标签键。</font>

  1. <font style="color:rgb(24, 24, 24);">单击</font><font style="color:rgb(24, 24, 24);">确定</font><font style="color:rgb(24, 24, 24);">。</font>

支持关联资源标签功能的资源

<font style="color:rgb(24, 24, 24);">主资源</font><font style="color:rgb(24, 24, 24);">关联资源</font><font style="color:rgb(24, 24, 24);">触发条件</font>
<font style="color:rgb(24, 24, 24);">ECS实例</font><font style="color:rgb(24, 24, 24);">云盘(包含数据盘和系统盘)</font>- <font style="color:rgb(24, 24, 24);">当云盘绑定到ECS实例时,将自动继承ECS实例的标签并跟随ECS实例标签变更。</font><br/>- <font style="color:rgb(24, 24, 24);">当云盘与ECS实例解绑时,系统将自动删除云盘上已继承的标签。</font>
<font style="color:rgb(24, 24, 24);">网卡(包含主网卡和辅助网卡)</font>- <font style="color:rgb(24, 24, 24);">当网卡绑定到ECS实例时,将自动继承ECS实例的标签并跟随ECS实例标签变更。</font><br/>- <font style="color:rgb(24, 24, 24);">当网卡与ECS实例解绑时,系统将自动删除网卡上已继承的标签。</font>
<font style="color:rgb(24, 24, 24);">弹性公网IP</font>- <font style="color:rgb(24, 24, 24);">当弹性公网IP绑定到ECS实例时,将自动继承ECS实例的标签并跟随ECS实例标签变更。</font><br/>- <font style="color:rgb(24, 24, 24);">当弹性公网IP与ECS实例解绑时,系统将自动删除弹性公网IP上已继承的标签。</font>
<font style="color:rgb(24, 24, 24);">云盘</font><font style="color:rgb(24, 24, 24);">快照</font>- <font style="color:rgb(24, 24, 24);">当基于云盘创建快照时,快照将自动继承云盘标签。</font><br/>- <font style="color:rgb(24, 24, 24);">当编辑云盘标签时,快照将跟随云盘标签变更。</font>
<font style="color:rgb(24, 24, 24);">云消息队列Kafka版实例</font><font style="color:rgb(24, 24, 24);">Topic</font>- <font style="color:rgb(24, 24, 24);">当基于云消息队列Kafka实例创建Topic时,Topic将自动继承Kafka实例标签。</font><br/>- <font style="color:rgb(24, 24, 24);">当编辑云消息队列Kafka实例标签时,Topic将跟随Kafka实例标签变更。</font>
<font style="color:rgb(24, 24, 24);">Consumer Group</font>- <font style="color:rgb(24, 24, 24);">当基于云消息队列Kafka实例创建ConsumerGroup时,ConsumerGroup将自动继承Kafka实例标签。</font><br/>- <font style="color:rgb(24, 24, 24);">当编辑云消息队列Kafka实例标签时,ConsumerGroup跟随Kafka实例标签变更。</font>
<font style="color:rgb(24, 24, 24);">容器服务Kubernetes版集群</font><font style="color:rgb(24, 24, 24);">安全组</font>- <font style="color:rgb(24, 24, 24);">当编辑容器服务Kubernetes版集群的标签时,安全组将跟随Kubernetes版集群标签变更。</font>
<font style="color:rgb(24, 24, 24);">ECS实例</font>- <font style="color:rgb(24, 24, 24);">当容器服务Kubernetes托管版集群扩容时,ECS实例将自动继承容器服务Kubernetes托管版集群标签。</font><br/>- <font style="color:rgb(24, 24, 24);">当编辑容器服务Kubernetes版集群的标签时,ECS实例将跟随Kubernetes版集群标签变更。</font>
<font style="color:rgb(24, 24, 24);">负载均衡实例</font>- <font style="color:rgb(24, 24, 24);">当编辑容器服务Kubernetes版集群的标签时,负载均衡实例将跟随Kubernetes版集群标签变更。</font>
<font style="color:rgb(24, 24, 24);">弹性公网IP</font>- <font style="color:rgb(24, 24, 24);">当编辑容器服务Kubernetes版集群的标签时,弹性公网IP将跟随Kubernetes版集群标签变更。</font>
<font style="color:rgb(24, 24, 24);">NAT网关</font>- <font style="color:rgb(24, 24, 24);">当编辑容器服务Kubernetes版集群的标签时,NAT网关将跟随Kubernetes版集群标签变更。</font>
<font style="color:rgb(24, 24, 24);">伸缩组</font>- <font style="color:rgb(24, 24, 24);">当编辑容器服务Kubernetes版集群的标签时,弹性伸缩的伸缩组将跟随Kubernetes版集群标签变更。</font>
<font style="color:rgb(24, 24, 24);">传统型负载均衡CLB实例</font><font style="color:rgb(24, 24, 24);">弹性公网IP</font>- <font style="color:rgb(51, 51, 51);">当弹性公网IP绑定到CLB实例时,将自动继承实例标签并跟随实例标签变更。</font><br/>- <font style="color:rgb(51, 51, 51);">当编辑CLB实例的标签时,弹性公网IP将跟随实例标签变更。</font>
<font style="color:rgb(24, 24, 24);">网络型负载均衡NLB实例</font><font style="color:rgb(24, 24, 24);">弹性公网IP</font>- <font style="color:rgb(51, 51, 51);">当弹性公网IP通过更新操作绑定到NLB实例时,将自动继承实例标签并跟随实例标签变更。</font><br/>- <font style="color:rgb(51, 51, 51);">当编辑NLB实例的标签时,弹性公网IP将跟随实例标签变更。</font>
<font style="color:rgb(24, 24, 24);">应用型负载均衡ALB实例</font><font style="color:rgb(24, 24, 24);">弹性公网IP</font>- <font style="color:rgb(51, 51, 51);">当弹性公网IP通过更新操作绑定到ALB实例时,将自动继承实例标签并跟随实例标签变更。</font><br/>- <font style="color:rgb(51, 51, 51);">当编辑ALB实例的标签时,弹性公网IP将跟随实例标签变更。</font>
<font style="color:rgb(24, 24, 24);">专有网络公网NAT网关</font><font style="color:rgb(24, 24, 24);">弹性公网IP</font>- <font style="color:rgb(51, 51, 51);">当弹性公网IP绑定到VPC公网NAT网关时,将自动继承实例标签并跟随实例标签变更。</font><br/>- <font style="color:rgb(51, 51, 51);">当弹性公网IP与VPC公网NAT网关解绑时,系统将自动删除已继承的标签。</font>

阿里云CloudOps
9 声望1 粉丝

CloudOps是传统IT运维和DevOps在云上的延展,通过云原生架构实现运维的再进化, 充分帮助企业降低云上IT运维成本、提升交付速度和系统灵活敏捷度、增强系统可靠性, 构建更加安全可信开放的业务平台。