通过Annotation配置负载均衡类型的服务 新建负载均衡规格为标准型Ⅰ service.beta.kubernetes.io/ctyunloadbalanceraddresstype: "internet" 新建负载均衡为公网类型 service.beta.kubernetes.io/ctyunloadbalancercycletype: "ondemand" 新建负载均衡计费模式为按需计费 service.beta.kubernetes.io/ctyunloadbalancerchargetype: "bandwidth" 公网计费按带宽计费 service.beta.kubernetes.io/ctyunloadbalancerbandwidth: "5" 公网带宽大小为5Mbps spec: selector: app: nginx ports: protocol: TCP port: 80 targetPort: 80 type: LoadBalancer 新建IPv6类型负载均衡 注解 描述 支持的CCM版本 service.beta.kubernetes.io/ctyunloadbalancerenableipv6 指定新建负载均衡时,可指定开启负载均衡的ipv6。取值: true false 注意 开启ipv6时,要求集群所在子网开启ipv6 v1.0.7及以上 service.beta.kubernetes.io/ctyunloadbalanceripv6address 指定新建支持ipv6的负载均衡时,可指定负载均衡的ipv6地址(该地址为负载均衡所在子网的ipv6地址段中未被分配的ip),未指定则由系统随机分配 v1.0.7及以上 service.beta.kubernetes.io/ctyunloadbalanceripv6bandwidthid 指定新建支持ipv6的公网负载均衡时,需指定IPv6带宽ID,可在网络控制台的IPv6带宽详情页面查看ID。如果没有IPv6带宽,请先创建一个 注意 创建IPv6带宽时需同步创建IPv6网关 v1.0.7及以上 service.beta.kubernetes.io/ctyunloadbalancerenablelistenernat64 指定支持ipv6的负载均衡时,可指定开启监听器的nat64,支持负载均衡将ipv6流量转发到ipv4的后端。取值: true false v1.0.7及以上 plaintext kind: Service apiVersion: v1 metadata: name: nginx annotations: service.beta.kubernetes.io/ctyunloadbalanceraddresstype: "internet" service.beta.kubernetes.io/ctyunloadbalancercycletype: "ondemand" service.beta.kubernetes.io/ctyunloadbalancerenableipv6: "true" service.beta.kubernetes.io/ctyunloadbalancerenablelistenernat64: "true" service.beta.kubernetes.io/ctyunloadbalanceripv6bandwidthid: "bandwidthylupxfrf8i" service.beta.kubernetes.io/ctyunloadbalancerspec: "elb.s2.small" spec: selector: app: nginx ports: protocol: TCP port: 80 targetPort: 80 type: LoadBalancer
来自: