云容器实例 CCI-调度负载到CCI:方式一:通过配置labels控制pod调度到CCI

时间:2024-09-27 16:27:02

方式一:通过配置labels控制pod调度到CCI

  • 通过CCE集群控制台(console)创建pod调度到CCI。通过CCE集群创建工作负载时,选择CCI弹性承载策略配置,选择“不开启”以外的任意策略。

    在CCE集群控制台(console)创建工作负载时,CCI弹性承载支持勾选“bursting-node”或者“virtual-kubelet”,如果使用CCI 1.0请勾选“virtual-kubelet”,如果使用CCI 2.0请勾选“bursting-node”。目前CCI 2.0仅对白名单用户开放,如需使用CCI2.0服务,请提交工单申请开启CCI2.0服务。

  • 通过yaml文件在CCE集群节点创建pod调度CCI。成功安装bursting插件后,登录CCE集群节点,在工作负载的yaml文件中添加virtual-kubelet.io/burst-to-cci标签。
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: test
      namespace: default
      labels:
        virtual-kubelet.io/burst-to-cci: 'auto'    # 弹性到CCI
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: test
      template:
        metadata:
          labels:
            app: test
        spec:
          containers:
            - image: 'nginx:perl'
              name: container-0
              resources:
                requests:
                  cpu: 250m
                  memory: 512Mi
                limits:
                  cpu: 250m
                  memory: 512Mi
              volumeMounts: []
          imagePullSecrets:
            - name: default-secret
support.huaweicloud.com/usermanual-cci/cci_01_0116.html