有奖捉虫:办公协同&微信生态&物联网文档专题 HOT

1. 接口描述

接口请求域名: tke.tencentcloudapi.com 。

创建容器实例

默认接口请求频率限制:20次/秒。

推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:CreateEKSContainerInstances。
Version String 公共参数,本接口取值:2018-05-25。
Region String 公共参数,详见产品支持的 地域列表
Containers.N Array of Container 容器组
示例值:[]
EksCiName String EKS Container Instance容器实例名称
示例值:""
SecurityGroupIds.N Array of String 指定新创建实例所属于的安全组Id
示例值:""
SubnetId String 实例所属子网Id
示例值:""
VpcId String 实例所属VPC的Id
示例值:[]
Memory Float 内存,单位:GiB。可参考资源规格文档
示例值:[]
Cpu Float CPU,单位:核。可参考资源规格文档
示例值:[]
RestartPolicy String 实例重启策略: Always(总是重启)、Never(从不重启)、OnFailure(失败时重启),默认:Always。
示例值:Always
ImageRegistryCredentials.N Array of ImageRegistryCredential 镜像仓库凭证数组
示例值:[]
EksCiVolume EksCiVolume 数据卷,包含NfsVolume数组和CbsVolume数组
示例值:[]
Replicas Integer 实例副本数,默认为1
示例值:1
InitContainers.N Array of Container Init 容器
示例值:[]
DnsConfig DNSConfig 自定义DNS配置
示例值:[]
ExistedEipIds.N Array of String 用来绑定容器实例的已有EIP的列表。如传值,需要保证数值和Replicas相等。
另外此参数和AutoCreateEipAttribute互斥。
示例值:[]
AutoCreateEipAttribute EipAttribute 自动创建EIP的可选参数。若传此参数,则会自动创建EIP。
另外此参数和ExistedEipIds互斥
示例值:[]
AutoCreateEip Boolean 是否为容器实例自动创建EIP,默认为false。若传true,则此参数和ExistedEipIds互斥
示例值:[]
CpuType String Pod 所需的 CPU 资源型号,如果不填写则默认不强制指定 CPU 类型。目前支持型号如下:
intel
amd
- 支持优先级顺序写法,如 “amd,intel” 表示优先创建 amd 资源 Pod,如果所选地域可用区 amd 资源不足,则会创建 intel 资源 Pod。
示例值:[]
GpuType String 容器实例所需的 GPU 资源型号,目前支持型号如下:
1/4*V100
1/2*V100
V100
1/4*T4
1/2*T4
T4
示例值:[]
GpuCount Integer Pod 所需的 GPU 数量,如填写,请确保为支持的规格。默认单位为卡,无需再次注明。
示例值:[]
CamRoleName String 为容器实例关联 CAM 角色,value 填写 CAM 角色名称,容器实例可获取该 CAM 角色包含的权限策略,方便 容器实例 内的程序进行如购买资源、读写存储等云资源操作。
示例值:[]

3. 输出参数

参数名称 类型 描述
EksCiIds Array of String EKS Container Instance Id集合,格式为eksci-xxx,是容器实例的唯一标识。
示例值:tci-xxx
RequestId String 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 创建容器实例

输入示例

POST / HTTP/1.1
Host: tke.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateEKSContainerInstances
<公共请求参数>

{
    "AutoCreateEipAttribute": {
        "InternetMaxBandwidthOut": 1,
        "DeletePolicy": "Immediate",
        "InternetServiceProvider": "BGP"
    },
    "CamRoleName": "xx",
    "VpcId": "vpc-12345678",
    "DnsConfig": {
        "Nameservers": [
            "xx"
        ],
        "Searches": [
            "xx"
        ],
        "Options": [
            {
                "Name": "xx",
                "Value": "xx"
            }
        ]
    },
    "Replicas": 1,
    "ImageRegistryCredentials": [
        {
            "Username": "xx",
            "Password": "xx",
            "Name": "xx",
            "Server": "xx"
        }
    ],
    "EksCiVolume": {
        "CbsVolumes": [
            {
                "CbsDiskId": "xx",
                "Name": "xx"
            }
        ],
        "NfsVolumes": [
            {
                "Path": "xx",
                "ReadOnly": true,
                "Name": "xx",
                "Server": "xx"
            }
        ]
    },
    "GpuCount": 1,
    "ExistedEipIds": [
        "eip-12345678"
    ],
    "AutoCreateEip": true,
    "RestartPolicy": "Always",
    "Cpu": 1.0,
    "Memory": 2.0,
    "SubnetId": "subnet-12345678",
    "CpuType": "amd,intel",
    "SecurityGroupIds": [
        "sg-12345678"
    ],
    "Containers": [
        {
            "Commands": [
                "sleep"
            ],
            "Name": "xx",
            "GpuLimit": 1,
            "WorkingDir": "xx",
            "Image": "xx",
            "Args": [
                "10000"
            ],
            "VolumeMounts": [
                {
                    "MountPropagation": "xx",
                    "ReadOnly": true,
                    "MountPath": "xx",
                    "SubPath": "xx",
                    "Name": "xx"
                }
            ],
            "RestartCount": 1,
            "EnvironmentVars": [
                {
                    "Name": "xx",
                    "Value": "xx"
                }
            ],
            "Memory": 0.0,
            "Cpu": 0.0
        }
    ],
    "EksCiName": "xx"
}

输出示例

{
    "Response": {
        "RequestId": "51d9ea5a-6e9e-4384-88da-84229e212220",
        "EksCiIds": [
            "eksci-bd80pz8s"
        ]
    }
}

5. 开发者资源

腾讯云 API 平台

腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。

API Inspector

用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。

SDK

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

命令行工具

6. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码

错误码 描述
FailedOperation 操作失败。
InternalError 内部错误。
InternalError.CamNoAuth 没有权限。
InternalError.CmdTimeout 执行命令超时。
InternalError.Param Param。
InternalError.UnexceptedInternal 内部错误。
InvalidParameter 参数错误。