Help Center/ Intelligent EdgeFabric/ API Reference/ API/ Deployment Management/ Querying a List of Application Instances
Updated on 2023-11-23 GMT+08:00

Querying a List of Application Instances

Function

This API is used to query a list of application instances.

URI

GET /v3/{project_id}/edgemgr/pods?{node_id=xxx,limit=xxx,offset=xxx}

The URI must contain at least one of the four ID query parameters: node_id, group_id, deployment_id or deployment_ids. For details, see Table 2.

Table 1 Path parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

node_id

No

String

Node ID by which application instances are queried. This field is optional.

Specify only one of the four fields: node_id, group_id, deployment_id, and deployment_ids.

group_id

No

String

Node group by which application instances are queried. This field is optional.

Specify only one of the four fields: group_id, node_id, deployment_id, and deployment_ids.

deployment_id

No

String

Deployment ID by which application instances are queried. This field is optional.

Specify only one of the four fields: deployment_id, node_id, group_id, and deployment_ids.

deployment_ids

No

String

Deployment IDs by which application instances are queried. Multiple IDs are separated by commas (,). This field is optional.

Specify only one of the four fields: deployment_ids, node_id, group_id, and deployment_id.

limit

No

Integer

Maximum number of records that can be returned.

offset

No

Integer

Offset. The records after this offset will be queried.

Request

Table 3 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

The default value application/json is recommended.

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response

When the status code is 200, the response parameters are as follows:

Table 4 Parameters in the response body

Parameter

Type

Description

count

Long

Total number of application instances.

pods

Array of PodResponse objects

-

Table 5 PodResponse

Parameter

Type

Description

id

String

ID of the application instance.

name

String

Name of the application instance.

configs

PodConfigs object

Application instance configuration.

affinity

affinity object

Affinity rules for the Deployment. This parameter is available only for platinum service instances.

init_containers

Array of ContainerResp objects

init container in the application instance.

containers

Array of ContainerResp objects

Service container in the application instance.

node_id

String

Node where the application instance is located.

deployment_id

String

Application ID.

project_id

String

Project ID.

reason

String

Cause of the application instance fault.

message

String

Details about the application instance fault.

created_at

String

Time when the application instance was created.

updated_at

String

Time when the application instance was updated.

state

String

Application instance status.

Table 6 ContainerResp

Parameter

Type

Description

args

Array of strings

Container startup arguments.

command

Array of strings

Container startup commands.

name

String

Container name. The name contains a maximum of 32 characters starting and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed.

envs

Array of Env objects

Key-value pair of the container environment variable.

image_url

String

Container image URL.

version

String

Container image version.

liveness_probe

Probe object

Workload liveness probe configuration.

readiness_probe

Probe object

Workload readiness probe configuration.

ports

Array of HostContainerPortMapping objects

Container port mapping.

resources

ResQuest object

Resource amount.

volumes

Array of Volume objects

Volumes attached to containers.

restarts

Long

Number of container restarts.

message

String

Container fault details.

reason

String

Container fault cause.

is_ready

String

Health check result.

privileged

Boolean

Whether the privileged container is enabled. The default value is false.

container_id

String

Container ID.

state

String

Container status.

npu_type

String

NPU type. NUP type supports D310.

  • D310
  • If this parameter is left blank, D310 is used.
Table 7 Volume

Parameter

Type

Description

name

String

Volume name. The name contains a maximum of 63 characters. Only lowercase letters and digits are allowed.

type

String

Volume type. The value can be configMap, secret, emptyDir, or hostPath.

read_only

Boolean

Read/Write permission. The default value is read.

source

String

Volume source. When type is set to hostPath, enter a path. The path must start with a slash (/) and can contain hyphens (-), slashes (/), underscores (_), periods (.), letters, and digits.

When type is set to secret, enter a secret name. When type is set to configMap, enter a ConfigMap name. When type is set to emptyDir, enter a disk or memory.

destination

String

Volume mount path. It must be a valid path.

Table 8 ResQuest

Parameter

Type

Description

limits

Res object

Resource amount limit.

requests

Res object

Requested resource amount.

Table 9 Res

Parameter

Type

Description

cpu

String

Number of CPU cores. The value range is 0.01–1000.

memory

String

Memory size, in MBs. The value range is 0.01–1,024,000. Note that the minimum value of limits for the memory is 4.

gpu

String

GPU size, in MBs. The value range is 0.01–1,024,000.

npu

String

Number of NPUs. The value range is 1–1000.

Table 10 HostContainerPortMapping

Parameter

Type

Description

container_port

Long

Container port number, which is an integer ranging from 1 to 65535.

host_port

Long

Container port number, which is an integer ranging from 1 to 65535.

host_ip

String

NIC address of the host.

Table 11 Probe

Parameter

Type

Description

http_get

HttpGet object

HTTP health check.

exec

Table 13 object

CLI-based check.

initial_delay_seconds

Long

Period between the workload start time and the probe start time. The value is an integer greater than 0 and less than or equal to 3600. The default value is 10.

timeout_seconds

Long

Probing timeout time. The value is an integer greater than 0 and less than or equal to 3600. The default value is 1.

Table 12 HttpGet

Parameter

Type

Description

path

String

The value must start with a slash (/). The structure is as follows: Protocol type://Host address:Port path

port

Integer

HTTP port number for detection. The value is an integer ranging from 1 to 65535.

host

String

Host address. The default value is the container IP address.

scheme

String

Protocol type. The value can be HTTP or HTTPS. The default value is HTTP.

Table 13 Exec

Parameter

Type

Description

command

String

Commands to be executed by the probe. The value contains a maximum of 10,240 characters.

Table 14 Env

Parameter

Type

Description

name

String

Key of an environment variable. The key contains a maximum of 2,048 characters starting with a letter or underscore. Only digits, letters, and underscores (_) are allowed.

value

String

Value of an environment variable. The value contains a maximum of 20,480 characters.

Table 15 PodConfigs

Parameter

Type

Description

host_network

Boolean

Whether the host network is enabled for an application instance. If the host network is not enabled, port mapping is used. The default value is false.

host_pid

Boolean

Whether an application instance shares the PID namespace with the host. The default value is false.

migration

Boolean

Whether an application instance is migrated when a fault occurs. This parameter is mandatory when the application is deployed to a specified node group. The default value is false.

restart_policy

String

Restart policy of an application instance. The value can be Always, OnFailure, or Never.

toleration_seconds

Integer

Time that a fault can be tolerated before an application instance is migrated. This parameter takes effect only when the application is deployed to a specified node group.

When the status code is 400, the response parameters are as follows:

Table 16 Parameters in the response body

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description.

When the status code is 500, the response parameters are as follows:

Table 17 Parameters in the response body

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description.

Example Request

GET https://{endpoint}//v3/{project_id}/edgemgr/pods?deployment_ids=a71077f0-a491-4e1c-a41a-7d6910da26cb,77340b19-b52e-4708-83fd-3ca86f5a292e

Example Response

Example response with status code 200:

{
    "count": 1,
    "pods": [
        {
            "id": "3e64d98a-37c5-43a6-9bfe-052b9083e362",
            "name": "app-test-69f9dc4b67-wfwn6",
            "description": "this is a test pod",
            "configs": {
                "host_network": true,
                "host_pid": true,
                "migration": true,
                "restart_policy": "Always",
                "toleration_seconds": 300
            },
            "containers": [
                {
                    "args": [
                        "-c",
                        "sleep 1000"
                    ],
                    "command": [
                        "/bin/bash"
                    ],
                    "name": "container-0",
                    "envs": [
                        {
                            "name": "CERT_PATH",
                            "value": "/opt/cert"
                        }
                    ],
                    "image_url": "",
                    "npu_type": "",
                    "liveness_probe": {
                        "http_get": {
                            "path": "/",
                            "port": 80,
                            "scheme": "http"
                        },
                        "initial_delay_seconds": 10,
                        "timeout_seconds": 10
                    },
                    "readiness_probe": {
                        "http_get": {
                            "path": "/",
                            "port": 80,
                            "scheme": "http"
                        },
                        "initial_delay_seconds": 10,
                        "timeout_seconds": 10
                    },
                    "ports": [
                        {
                            "container_port": 80,
                            "host_port": 80
                        }
                    ],
                    "resources": {
                        "limits": {
                            "cpu": 0.25,
                            "memory": 500,
                            "gpu": 500
                        },
                        "requests": {
                            "cpu": 0.25,
                            "memory": 500,
                            "gpu": 500
                        }
                    },
                    "volumes": [
                        {
                            "name": "log-volume",
                            "type": "hostPath",
                            "read_only": false,
                            "source": "/var/IEF",
                            "destination": "/var/IEF"
                        }
                    ],
                    "restarts": 0,
                    "message": "",
                    "reason": ""
                }
            ],
            "node_id": "ff5f5129-f53f-4129-9f7f-ca7837063b5f",
            "project_id": "bcd83056c918480f8f190844bd425b23",
            "reason": "",
            "message": "",
            "created_at": "2019-10-10T02:24:02.325Z",
            "updated_at": "2019-10-10T02:24:02.325Z",
            "state": "RUNNING"
        }
    ]
}

Example response with status code 400:

{
	"error_code" : "IEF.100001",
	"error_msg" : "PROJECT_ID not found"
}

Example response with status code 500:

{
	"error_code" : "IEF.100158",
	"error_msg" : "Fail to extract gpu information"
}

Error Codes

For details, see Error Codes.