调用UpdateContainerGroup更新实例。
接口说明
- 仅支持处于启动中(Pending)或运行中(Running)状态的ECI实例进行更新。更新操作后,ECI实例状态将变更为更新中(Updating)。
- 不支持ECI实例级别的规格变配,仅支持在不影响实例规格的情况下,容器级别的规格变配。
- 创建时间早于2019-03-07 15:00:00的ECI实例不支持更新。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 否 | UpdateContainerGroup |
系统规定参数。取值:UpdateContainerGroup。 |
ContainerGroupId | String | 是 | eci-2zelg8vwnlzdhf8hv**** |
指定需要更新的ECI实例ID,即容器组ID。 |
RegionId | String | 是 | cn-hangzhou |
所属地域ID。 |
RestartPolicy | String | 否 | Always |
ECI实例(容器组)的重启策略。 |
Tag.N.Key | String | 否 | name |
标签键。 |
Tag.N.Value | String | 否 | hxh |
标签值。 |
Volume.N.Name | String | 否 | test-empty |
数据卷名称。 |
Volume.N.Type | String | 否 | EmptyDirVolume |
数据卷类型,取值范围:
|
Volume.N.NFSVolume.Server | String | 否 | 0eaf24bfc1-xxxxx.cn-hangzhou.nas.aliyuncs.com |
NFS服务器地址。 |
Volume.N.NFSVolume.Path | String | 否 | / |
NFS数据卷路径。 |
Volume.N.NFSVolume.ReadOnly | Boolean | 否 | false |
是否只读。默认为false。 |
Volume.N.ConfigFileVolume.ConfigFileToPath.N.Content | String | 否 | bGl1bWk= |
配置文件内容 (32KB)。 |
Volume.N.ConfigFileVolume.ConfigFileToPath.N.Path | String | 否 | liu/name |
相对文件路径。 |
Volume.N.EmptyDirVolume.Medium | String | 否 | Memory |
EmptyDirVolume的存储媒介。默认为空,表示使用node文件系统,您也可以配置为Memory,表述使用内存。 |
DnsConfig.NameServer.N | RepeatList | 否 | 1.2.3.4 |
DNS服务器的IP地址列表。 |
DnsConfig.Search.N | RepeatList | 否 | my.dns.search.suffix |
DNS搜索域列表。 |
DnsConfig.Option.N.Name | String | 否 | ndots |
选项变量名。 |
DnsConfig.Option.N.Value | String | 否 | 2 |
选项变量值。 |
Container.N.Name | String | 否 | jenkins |
容器名称。 |
Container.N.Image | String | 否 | jenkins |
容器镜像。 |
Container.N.Cpu | Float | 否 | 1.0 |
容器vCPU大小。 |
Container.N.Memory | Float | 否 | 2.0 |
容器内存大小。 |
Container.N.WorkingDir | String | 否 | /usr/share/ |
容器工作目录。 |
Container.N.ImagePullPolicy | String | 否 | Never |
镜像拉取策略。 |
Container.N.Stdin | Boolean | 否 | false |
此容器是否应在容器运行时为标准输入分配缓冲区。如果未设置,则容器中标准输入的读取值将导致EOF。默认为false。 |
Container.N.StdinOnce | Boolean | 否 | true |
当标准输入为true时,标准输入流将在多个附加会话中保持开启状态。如果StdinOnce设为true,标准输入在容器开启时被打开,在首个客户端附加到标准输入之前都为空,然后会一直保持开启状态,接收数据,直到客户端连接断开,此时标准输入被关闭,在容器重启前一直保持关闭状态。 |
Container.N.Tty | Boolean | 否 | false |
是否开启交互。默认为false,如果Command为/bin/bash类型,需要设置为true。 |
Container.N.Command.N | RepeatList | 否 | echo |
容器启动命令。最多20个,单个命令支持256个字符。 |
Container.N.Arg.N | RepeatList | 否 | hello |
容器启动参数。最多10个。 |
Container.N.EnvironmentVar.N.Key | String | 否 | PATH |
容器的环境变量名。 |
Container.N.EnvironmentVar.N.Value | String | 否 | /usr/bin/local/ |
容器的环境变量值。 |
Container.N.EnvironmentVar.N.FieldRef.FieldPath | String | 否 | status.podIP |
使用Pod字段作为环境变量。目前仅支持status.podIP。 |
Container.N.Port.N.Protocol | String | 否 | TCP |
TCP/UDP。 |
Container.N.Port.N.Port | Integer | 否 | 8080 |
端口号。取值范围:1~65535 |
Container.N.VolumeMount.N.Name | String | 否 | test-empty |
容器挂载的数据卷名称。从ECI实例(容器组)挂载的数据卷中选择,即取值范围为配置的Volume.N.Name参数。 |
Container.N.VolumeMount.N.MountPath | String | 否 | /usr/share/ |
容器挂载的目录。容器挂载目录下的内容会被volume的内容直接覆盖,请谨慎使用。 |
Container.N.VolumeMount.N.SubPath | String | 否 | /usr/share/sub/ |
数据卷的子目录,方便Pod将同一个Volume下不同目录挂载到容器不同目录。 |
Container.N.VolumeMount.N.ReadOnly | Boolean | 否 | false |
是否只读。默认值:false |
Container.N.VolumeMount.N.MountPropagation | String | 否 | None |
数据卷的挂载传播设置。挂载传播允许将Container挂载的卷共享到同一Pod中的其他Container,甚至可以共享到同一节点上的其他Pod。取值范围:
默认值:None |
Container.N.ReadinessProbe.TcpSocket.Port | Integer | 否 | 5000 |
TcpSocket检测的端口。 |
Container.N.ReadinessProbe.Exec.Command.N | RepeatList | 否 | [/bin/sh cat /tmp/healthy] |
容器内检测的命令。 |
Container.N.ReadinessProbe.HttpGet.Path | String | 否 | /usr/ |
HttpGet检测的路径。 |
Container.N.ReadinessProbe.HttpGet.Port | Integer | 否 | 8080 |
HttpGet检测的端口号。 |
Container.N.ReadinessProbe.HttpGet.Scheme | String | 否 | HTTP |
HTTP/HTTPS 。 |
Container.N.ReadinessProbe.InitialDelaySeconds | Integer | 否 | 10 |
检查开始执行的时间。以容器启动完成为起点开始计算。 |
Container.N.ReadinessProbe.PeriodSeconds | Integer | 否 | 10 |
检查执行的周期。默认为10秒,最小为1秒。 |
Container.N.ReadinessProbe.SuccessThreshold | Integer | 否 | 3 |
从上次检查失败后重新认定检查成功的检查次数阈值(必须是连续成功)。默认为1次。 |
Container.N.ReadinessProbe.FailureThreshold | Integer | 否 | 3 |
从上次检查成功后认定检查失败的检查次数阈值(必须是连续失败)。默认为3次。 |
Container.N.ReadinessProbe.TimeoutSeconds | Integer | 否 | 5 |
检查超时的时间。默认为1秒,最小为1秒。 |
Container.N.LivenessProbe.TcpSocket.Port | Integer | 否 | 80 |
TcpSocket检测的端口。 |
Container.N.LivenessProbe.Exec.Command.N | RepeatList | 否 | [/bin/sh cat /tmp/healthy] |
容器内检测命令。 |
Container.N.LivenessProbe.HttpGet.Path | String | 否 | /usr/local/bin |
HttpGet检测的路径。 |
Container.N.LivenessProbe.HttpGet.Port | Integer | 否 | 8080 |
HttpGet检测的端口号。 |
Container.N.LivenessProbe.HttpGet.Scheme | String | 否 | HTTP |
HTTP/HTTPS。 |
Container.N.LivenessProbe.InitialDelaySeconds | Integer | 否 | 10 |
检查开始执行的时间。以容器启动完成为起点开始计算。 |
Container.N.LivenessProbe.PeriodSeconds | Integer | 否 | 10 |
检查执行的周期。默认为10秒,最小为1秒。 |
Container.N.LivenessProbe.SuccessThreshold | Integer | 否 | 1 |
从上次检查失败后重新认定检查成功的检查次数阈值(必须是连续成功)。默认为1次,当前必须为1次。 |
Container.N.LivenessProbe.FailureThreshold | Integer | 否 | 3 |
从上次检查成功后认定检查失败的检查次数阈值(必须是连续失败)。默认为3次。 |
Container.N.LivenessProbe.TimeoutSeconds | Integer | 否 | 1 |
检查超时的时间。默认为1秒,最小为1秒。 |
Container.N.SecurityContext.ReadOnlyRootFilesystem | Boolean | 否 | true |
是否只读根文件系统。取值目前仅支持:true。 |
Container.N.SecurityContext.RunAsUser | Long | 否 | 1337 |
用于运行容器进程入口点的UID。 |
Container.N.SecurityContext.Capability.Add.N | RepeatList | 否 | NET_ADMIN |
枚举值。取值目前仅支持:NET_ADMIN |
Container.N.Gpu | Integer | 否 | 1 |
指定容器使用的GPU个数。 |
InitContainer.N.Name | String | 否 | init-nginx |
Init容器名称。 |
InitContainer.N.Image | String | 否 | nginx |
Init容器镜像。 |
InitContainer.N.Cpu | Float | 否 | 2.0 |
Init容器vCPU大小。 |
InitContainer.N.Memory | Float | 否 | 4.0 |
Init容器内存大小。 |
InitContainer.N.WorkingDir | String | 否 | /bin/local/ |
Init容器工作目录。 |
InitContainer.N.ImagePullPolicy | String | 否 | Onfailure |
镜像拉取策略。 |
InitContainer.N.Stdin | Boolean | 否 | false |
此容器是否应在容器运行时为标准输入分配缓冲区。如果未设置,则容器中标准输入的读取值将导致EOF。默认为false。 |
InitContainer.N.StdinOnce | Boolean | 否 | true |
当标准输入为true时,标准输入流将在多个附加会话中保持开启状态。如果StdinOnce设为true,标准输入在容器开启时被打开,在首个客户端附加到标准输入之前都为空,然后会一直保持开启状态,接收数据,直到客户端连接断开,此时标准输入被关闭,在容器重启前一直保持关闭状态。 |
InitContainer.N.Tty | Boolean | 否 | true |
是否开启交互。默认为false,如果Command为/bin/bash类型时,需要设置为true。 |
InitContainer.N.Command.N | RepeatList | 否 | /bin/sh sleep |
Init容器指令。 |
InitContainer.N.Arg.N | RepeatList | 否 | 10 |
Init容器启动参数。 |
InitContainer.N.EnvironmentVar.N.Key | String | 否 | PATH |
Init容器的环境变量名。 |
InitContainer.N.EnvironmentVar.N.Value | String | 否 | /usr/local/bin |
Init容器的环境变量值。 |
InitContainer.N.EnvironmentVar.N.FieldRef.FieldPath | String | 否 | status.podIP |
用Pod字段作为环境变量值。 |
InitContainer.N.Port.N.Port | Integer | 否 | 9000 |
Init容器端口号 。取值范围:1~65535。 |
InitContainer.N.Port.N.Protocol | String | 否 | TCP |
TCP/UDP。 |
InitContainer.N.VolumeMount.N.Name | String | 否 | default-volume1 |
Init容器挂载的数据卷名称。从ECI实例(容器组)挂载的数据卷中选择,即取值范围为配置的Volume.N.Name参数。 |
InitContainer.N.VolumeMount.N.MountPath | String | 否 | /pod/data |
Init容器挂载目录。容器挂载目录下的内容将被volume的内容直接覆盖,请谨慎使用。 |
InitContainer.N.VolumeMount.N.SubPath | String | 否 | data2/ |
数据卷的子目录,方便Pod将同一个Volume下不同目录挂载到容器不同目录。 |
InitContainer.N.VolumeMount.N.ReadOnly | Boolean | 否 | false |
是否只读。默认值:false |
InitContainer.N.VolumeMount.N.MountPropagation | String | 否 | None |
数据卷的挂载传播设置。挂载传播允许将Container挂载的卷共享到同一Pod中的其他Container,甚至可以共享到同一节点上的其他Pod。取值范围:
默认值:None |
InitContainer.N.SecurityContext.ReadOnlyRootFilesystem | Boolean | 否 | true |
是否只读根文件系统。 |
InitContainer.N.SecurityContext.RunAsUser | Long | 否 | 1000 |
用于运行容器进程入口点的UID。 |
InitContainer.N.SecurityContext.Capability.Add.N | RepeatList | 否 | NET_ADMIN |
枚举值。取值目前仅支持:NET_ADMIN |
InitContainer.N.Gpu | Integer | 否 | 1 |
指定Init容器使用的GPU个数。 |
ImageRegistryCredential.N.Server | String | 否 | registry.cn-shanghai.aliyuncs.com/ecitest/nginx:alpine |
不带
|
ImageRegistryCredential.N.UserName | String | 否 | yourname |
镜像仓库用户名。 |
ImageRegistryCredential.N.Password | String | 否 | yourpassword |
镜像仓库密码。 |
ClientToken | String | 否 | 123e4567-e89b-12d3-a456-426655440000 |
保证请求幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。只支持ASCII字符,且不能超过64个字符。更多详情,请参阅如何保证幂等性。 |
Cpu | Float | 否 | 2.0 |
实例(容器组)级别的vCPU。 |
Memory | Float | 否 | 4.0 |
实例(容器组)级别的内存数。 |
ResourceGroupId | String | 否 | rg-2df3isufhi38**** |
所属资源组ID。 |
参数说明
Container和InitContainerInitContainer和Container均仅支持全量更新。更新InitContainer需要重启实例。
更新包括以下几种情况:
- 原ECI实例同时有InitContainer和Container,但只更新InitContainer。
- 原ECI实例同时有InitContainer和Container,但只更新Container。
- 原ECI实例同时有InitContainer和Container,InitContainer和Container全部更新。
- 原ECI实例只有Container,更新Container。
- 原ECI实例只有Container,增加InitContainer。
- 原ECI实例只有Container,增加InitContainer,同时更新Container。
更新volume的参数要求和创建时的参数要求一致。
- 仅支持全量更新。
-
需要重启ECI实例。说明 Container通过Volume Name来匹配挂载的Volume,所以单独更新Volume只是修改Voulme内部一些基本参数,大的更新需要伴随Container一起更新,比如数量、Name发生变化。
- 仅支持全量更新。
- 如果是单独更新ImageRegistryCredentials,且更新后的ImageRegistryCredentials的数量不超过之前原ImageRegistryCredentials,则无需重启ECI实例,其他情况会重启ECI实例。
- 仅支持全量更新。
- 无需重启ECI。
- 仅支持全量更新。
- 需要重启ECI实例。
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | CB8D2B22-D636-4182-****-1FC9DBDAD66F |
请求ID,唯一标识。 |
示例
请求示例
https://eci.aliyuncs.com//?Action=UpdateContainerGroup
&ContainerGroupId=eci-2zelg8vwnlzdhf8hv****
&RegionId=cn-hangzhou
&<公共请求参数>
正常返回示例
XML
格式
<UpdateContainerGroup>
<RequestId>CB8D2B22-D636-4182-****-1FC9DBDAD66F</RequestId>
</UpdateContainerGroup>
JSON
格式
{
"RequestId":"CB8D2B22-D636-4182-****-1FC9DBDAD66F"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | InvalidParameter.CPU.Memory | The specified cpu and memory are not allowed | cpu,mem不符合规格 |
400 | InvalidParameter.DuplicatedName | The container group include containers with duplicate names. | 容器组内有重复名字的容器。 |
400 | InvalidParameter.DuplicatedVolumeName | The container group includes volumes with duplicate names. | 容器组内有重复名字的数据卷。 |
400 | InvalidParameter.LengthExceeded | %s | List型参数的长度超过规定值 |
404 | InvalidParameter.NotFound | %s | 参数未找到 |
400 | InvalidParameter.ValueExceeded | %s | 参数值超过规定范围 |
400 | IncorrectStatus | %s | 指定的实例状态不正确。 |
403 | InvalidAction | The specified action is invalid | 不合法的操作 |
400 | InvalidParam.CpuOrMemorySpec | The specified specification is invalid. | 指定的规格还未开放售卖,不提供价格查询。 |
400 | InvalidParameter | %s | 不合法的参数 |
400 | MissingParameter | %s | 必填参数缺失 |
400 | NoNeedUpdate | There are no changes to be updated for current resource. | 本次操作没有需要更新的参数 |
访问错误中心查看更多错误码。