All Products
Search
Document Center

Container Service for Kubernetes:DescribePolicyInstances

Last Updated:Nov 08, 2024
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Queries the detailed information about policy instances of the specified type in a Container Service for Kubernetes (ACK) cluster, such as the policy description and severity level. You can choose a type of security policy for an ACK cluster, specify the action and applicable scope of the policy, and then create and deploy a policy instance.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cs:DescribePolicyInstancesget
  • Cluster
    acs:cs:{#regionId}:{#accountId}:cluster/{#ClusterId}
    none
none

Request syntax

GET /clusters/{cluster_id}/policies HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
cluster_idstringYes

The cluster ID.

c8155823d057948c69a****
policy_namestringNo

The name of the policy that you want to query.

ACKPSPCapabilities
instance_namestringNo

The name of the policy instance that you want to query.

allowed-repos-cz4s2

Response parameters

ParameterTypeDescriptionExample
array<object>

The list of the returned policy instances.

Instanceobject
ali_uidstring

The UID of the Alibaba Cloud account that is used to deploy the policy instance.

16298168****
cluster_idstring

The ID of the cluster.

c8155823d057948c69a****
instance_namestring

The name of the policy instance.

no-env-var-secrets-****
policy_namestring

The name of the policy.

ACKPSPCapabilities
policy_categorystring

The type of policy.

k8s-general
policy_descriptionstring

The description of the policy template.

Restricts secrets used in pod envs
policy_parametersstring

The parameters of the policy instance.

"restrictedNamespaces": [ "test" ]
policy_severitystring

The severity level of the policy instance.

low
policy_scopestring

The applicable scope of the policy instance.

A value of * indicates all namespaces in the cluster. This is the default value.

Multiple namespaces are separated by commas (,).

*
policy_actionstring

The action of the policy. Valid values:

  • deny: Deployments that match the policy are denied.
  • warn: Alerts are generated for deployments that match the policy.
deny
Createddeprecatedstring

Creation time (deprecated, do not use).

2024-10-29T18:09:12+08:00
Updateddeprecatedstring

Update time (deprecated, do not use).

2024-10-29T18:09:12+08:00
resource_iddeprecatedstring

Resource ID (deprecated, do not use).

123456***
total_violationsdeprecatedlong

Violation count processing in the cluster (deprecated, do not use).

0
is_deleteddeprecatedlong

Deletion status (deprecated, do not use).

0

Examples

Sample success responses

JSONformat

[
  {
    "ali_uid": "16298168****",
    "cluster_id": "c8155823d057948c69a****",
    "instance_name": "no-env-var-secrets-****",
    "policy_name": "ACKPSPCapabilities",
    "policy_category": "k8s-general",
    "policy_description": "Restricts secrets used in pod envs",
    "policy_parameters": "\"restrictedNamespaces\": [ \"test\" ]",
    "policy_severity": "low",
    "policy_scope": "*",
    "policy_action": "deny",
    "Created": "2024-10-29T18:09:12+08:00",
    "Updated": "2024-10-29T18:09:12+08:00",
    "resource_id": "123456***",
    "total_violations": 0,
    "is_deleted": 0
  }
]

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-10-23The response structure of the API has changedView Change Details