Updated on 2025-08-12 GMT+08:00

Associating a Service with a PoolBinding

A PoolBinding can be associated with a Service. After a PoolBinding is created, the endpoints of the pods for the Service are automatically added to or removed from the associated backend server group.

Constraints

The backend server group associated with a PoolBinding cannot be the one associated with the load balancer of the Service.

Prerequisites

  • You have created a backend server group on the ELB console.
  • You have created a Deployment on the CCI 2.0 console.
  • You have created a Service on the CCI 2.0 console.

Method 1: Managing PoolBindings Using ccictl

  • poolbinding.yaml example
    apiVersion: loadbalancer.networking.openvessel.io/v1
    kind: PoolBinding
    metadata:
      name: test-c1       //Name of the PoolBinding to be created
      namespace: test-ns  //Namespace of the PoolBinding. It must be in the same namespace as the associated Service.
    spec:
      poolRef:
        id: e08*****-****-****-****-********29c1 //ID of the created backend server group
      targetRef:
        kind: Service    //Type of the backend object. In this example, the backend object is a Service.
        group: cci/v2    //Group of the backend object
        name: test-name   //Name of the backend object, which is the name of the created Service in this example
        port: 123        //Target port number of the associated backend object. If the backend object is a Service, the value is the access port of the Service.
  • Common ccictl commands
    // Create a PoolBinding.
    ccictl create -f poolbinding.yaml
    // Query details about all PoolBindings in a namespace.
    ccictl get poolbindings -n $namespace -oyaml
    // Query a PoolBinding in a namespace.
    ccictl get poolbindings -n $namespace $name -oyaml
    // Delete a PoolBinding.
    ccictl delete poolbindings -n $namespace $name
Table 1 Key parameter descriptions

Parameter

Description

$namespace-name

Namespace of the PoolBinding. It must be in the same namespace as the associated Deployment.

$name

PoolBinding name

Method 2: Managing PoolBindings Using curl Commands

  • poolbinding.json example
    {
        "apiVersion": "loadbalancer.networking.openvessel.io/v1",
        "kind": "PoolBinding",
        "metadata": {
            "name": "test-c1",       //Name of the PoolBinding to be created
            "namespace": "test-ns"  //Namespace of the PoolBinding. It must be in the same namespace as the associated Service.
        },
        "spec": {
            "poolRef": {
                "id": "e08*****-****-****-****-********29c1"  //ID of the created backend server group
            },
            "targetRef": {
                 "kind": "Service",   //Type of the backend object. In this example, the backend object is a Service.
                "group": "cci/v2",    //Group of the backend object
                "name": "test-name",  //Name of the backend object, which is the name of the created Service in this example
                "port": 123           //Target port number of the associated backend object. If the backend object is a Service, the value is the access port of the Service.
            }
        }
    }
  • Common curl commands
    // Create a PoolBinding.
    curl -k -H "Content-Type: application/json" -H "X-Auth-Token: $token" "https://$endpoint/apis/loadbalancer.networking.openvessel.io/v1/namespaces/$namespace-name/poolbindings" -X POST -d@poolbinding.json
    // Query details about all PoolBindings in a namespace.
    curl -k -H "Content-Type: application/json" -H "X-Auth-Token: $token" "https://$endpoint/apis/loadbalancer.networking.openvessel.io/v1/namespaces/$namespace-name/poolbindings"
    // Query a PoolBinding in a namespace.
    curl -k -H "Content-Type: application/json" -H "X-Auth-Token: $token" "https://$endpoint/apis/loadbalancer.networking.openvessel.io/v1/namespaces/$namespace-name/poolbindings/$name"
    // Delete a PoolBinding.
    curl -k -H "Content-Type: application/json" -H "X-Auth-Token: $token" "https://$endpoint/apis/loadbalancer.networking.openvessel.io/v1/namespaces/$namespace-name/poolbindings/$name" -X DELETE
Table 2 Key parameters in the commands

Parameter

Description

$token

Token used to authenticate requests.

$endpoint

CCI 2.0 endpoint.

An endpoint is the request address for calling an API. Endpoints vary with services and regions. An endpoint can be obtained from Regions and Endpoints.

$namespace-name

Namespace of the PoolBinding. It must be in the same namespace as the associated Deployment.

$name

PoolBinding name