通过注解实现ECI自动分配EIP、分配带宽大小
更新时间 2026-01-15 18:47:21
最近更新时间: 2026-01-15 18:47:21
本文为您介绍如何通过注解实现ECI自动分配EIP、分配带宽大小。
操作步骤
打开云容器引擎集群控制台,点击集群名称。
选择工作负载菜单,点击无状态,进入无状态列表页。
点击“新增YAML”按钮。
为Pod 添加注解,以Deployment 为例:
k8s.ctyun.cn/eci-with-eip: "true" # 可选,设置则自动分配 EIP
k8s.ctyun.cn/eip-bandwidth: "5" # 可选,单位 Mbps,默认 5MbpsDeployment 完整模板
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
annotations:
generation: 1
labels:
app: "nginx"
name: "test-eip"
namespace: "default"
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: "nginx"
strategy:
rollingUpdate:
maxSurge: "25%"
maxUnavailable: "25%"
type: "RollingUpdate"
template:
metadata:
annotations:
k8s.ctyun.cn/eci-with-eip: "true"
k8s.ctyun.cn/eip-bandwidth: "5"
labels:
app: "nginx"
spec:
containers:
image: "registry-xinan1.crs-internal.ctyun.cn/open-source/nginx:1.25-alpine"
imagePullPolicy: "IfNotPresent"
name: "nginx"
ports:
- containerPort: 80
protocol: "TCP"
terminationMessagePath: "/dev/termination-log"
terminationMessagePolicy: "File"
dnsPolicy: "ClusterFirst"
nodeName: "vnd-bsb398x4k2oz06kn-cn-xinan1-xn1a-public-ctcloud"
restartPolicy: "Always"
schedulerName: "default-scheduler"
terminationGracePeriodSeconds: 30注意
通过yaml 创建,此处需要指定节点为 vnode:
nodeName: "vnd-bsb398x4k2oz06kn-cn-xinan1-xn1a-public-ctcloud"创建完成可通过ECI 控制台查看生效。
注意
验证EIP 功能,如果不通,优先查看安全组设置。
vnode 查询路径
打开云容器引擎集群控制台,点击集群名称。
选择节点管理菜单,点击节点,进入节点列表页。
vnd开头的节点即为vnode。