All Products
Search
Document Center

Container Service for Kubernetes:CreateTemplate

Last Updated:Apr 22, 2024

Creates an orchestration template. An orchestration template defines and describes a group of Kubernetes resources. It declaratively describes the configuration of an application or how an application runs. You can use orchestration templates to manage resources in Kubernetes clusters and automate resource deployment, such as pods, Services, Deployments, ConfigMaps, and persistent volumes (PVs).

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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:CreateTemplateWrite
  • All Resources
    *
    none
none

Request syntax

POST /templates

PUT /templates

Request parameters

ParameterTypeRequiredDescriptionExample
bodyobjectNo

The request body.

namestringYes

The name of the orchestration template.

The name must be 1 to 63 characters in length, and can contain digits, letters, and hyphens (-). It cannot start with a hyphen (-).

service-account-template
templatestringYes

The template content in the YAML format.

apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: test-sa
tagsstringNo

The label of the template.

test
descriptionstringNo

The description of the template.

this is test
template_typestringNo

The type of template. You can set the parameter to a custom value.

  • If the parameter is set to kubernetes, the template is displayed on the Templates page in the console.
  • If you set the parameter to compose, the template is not displayed in the console.

We recommend that you set the parameter to kubernetes.

Default value: compose.

kubernetes

Response parameters

ParameterTypeDescriptionExample
object

The response body.

template_idstring

The ID of the orchestration template.

ba1fe77b-b01e-4640-b77e-8f1b80e3e3cf

Examples

Sample success responses

JSONformat

{
  "template_id": "ba1fe77b-b01e-4640-b77e-8f1b80e3e3cf"
}

Error codes

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

Change history

Change timeSummary of changesOperation
No change history