Managing Cloud Pak for Data service instances by command line

The cpd-cli service-instance command line interface can manage Cloud Pak for Data service instances.

Before you run any cpd-cli service-instance commands, ensure that:

The following commands use an example profile named default.

Manage service instances

To list all of the service instances in your Cloud Pak for Data instance:

cpd-cli service-instance list --profile default --output type

For the output type, you can specify json, text, or yaml. The default output type is text.

Example of the service instance list:
 Namespace           Service type        Version             ID                  Name                  Provision status    Upgrade version option 
 ---------           ------------        -------             --                  ----                  ----------------    ---------------------- 
 default             volumes             -                   1600820045121846    vol1                  PROVISIONED         [] 
 default             streams             5.5.0               1600738738149514    streamsvc             PROVISIONED         [] 
 default             dv                  1.5.0.0             1600736770511387    data-virtualization   PROVISIONED         [] 

To retrieve status on a specific service instance:

cpd-cli service-instance status name --profile default --output type

For the output type, you can specify json, text, or yaml. The default output type is text.

 Namespace           Service type        Version             ID                  Name                  Provision status    Service status 
 ---------           ------------        -------             --                  ----                  ----------------    -------------- 
 default             dv                  1.5.0.0             1600736770511387    data-virtualization   PROVISIONED         RUNNING
Example of the service instance status:

To retrieve details on a specific service instance:

cpd-cli service-instance get name --profile default --output type

For the output type, you can specify json or yaml. The default output type is json.

Example of a service instance JSON file:
{
  "service_instance": {
    "addon_type": "dv",
    "addon_version": "1.5.0.0",
    "connection_info": {
      "jdbc": "jdbc:db2://dv-server.default.svc.cluster.local:32051/bigsql"
    },
    "created_at": "2020-09-22T01:06:28.432179Z",
    "description": "Data Virtualization",
    "display_name": "data-virtualization",
    "id": "1600736770511387",
    "instance_identifiers": [
      "dv-0-1600736770511387",
      "dv-1-1600736770511387",
      "dv-2-1600736770511387",
      "dv-3-1600736770511387"
    ],
    "metadata": {},
    "misc_data": {},
    "namespace": "default",
    "owner_uid": "1000000999",
    "owner_username": "user123",
    "parameters": {
      "enableHostIPC": "true",
      "image.pullPolicy": "IfNotPresent",
      "persistence.cachingpv.size": "100Gi",
      "persistence.cachingpv.storageClass": "managed-nfs-storage",
      "persistence.size": "50Gi",
      "persistence.storageClass": "managed-nfs-storage",
      "persistence.workerpv.size": "25Gi",
      "persistence.workerpv.storageClass": "managed-nfs-storage",
      "resources.dv.requests.cpu": "4",
      "resources.dv.requests.memory": "16Gi",
      "workerCount": "1"
    },
    "provision_status": "PROVISIONED",
    "resources": {
      "cpu": "4",
      "memory": "16"
    },
    "roles": [
      "Admin"
    ],
    "updated_at": "2020-10-07T00:51:51.842894Z",
    "zen_service_instance_info": {
      "docker_registry_prefix": "image-registry.openshift-image-registry.svc:5000/profile"
    }
  }
}

To retrieve details on all service instances of the same service type:

cpd-cli service-instance get --service-type type --all --profile default --output type --output-dir directory_to_write_the_output_to

For the output type, you can specify json or yaml. The default output type is json.

Upgrade service instances

To upgrade a specific service instance in your Cloud Pak for Data instance:

cpd-cli service-instance upgrade --instance-name name --service-type type --profile default

Append --version if you need to upgrade to a specific version. Append --watch to continuously monitor the upgrade progress.

To upgrade all service instances of the same service type:

cpd-cli service-instance upgrade --service-type type --all --profile default

Append --watch to continuously monitor the upgrade progress.

Delete a service instance

To delete a specific service instance:

cpd-cli service-instance delete name --service-type type --profile default

The command submits a request to de-provision the service instance. Use the cpd-cli service-instance status command to monitor the status.