Manage image caches for Elastic Container Instance (ECI) using the Kubernetes-style ImageCache custom resource. Image caches pre-pull container images onto cloud disks, reducing Pod startup time in ECI.
All operations use the API group eci.alibabacloud.com/v1 and are accessible through a kubectl proxy running on port 8001.
Data types
ImageCacheList
| Parameter | Type | Description |
|---|---|---|
| apiVersion | String | The API group and version. Set to eci.alibabacloud.com/v1. |
| kind | String | The resource type. Set to ImageCacheList. |
| metadata | ListMeta | The standard list metadata. |
| items | ImageCache[] | The image caches returned by the list. |
ImageCache
| Parameter | Type | Description |
|---|---|---|
| apiVersion | String | The API group and version. Set to eci.alibabacloud.com/v1. |
| kind | String | The resource type. Set to ImageCache. |
| metadata | ObjectMeta | The metadata of the object, including name, uid, and timestamps. |
| spec | ImageCacheSpec | The desired configuration of the image cache. |
| status | ImageCacheStatus | The current state of the image cache. Populated by the system; read-only. |
ImageCacheSpec
| Parameter | Type | Required | Description |
|---|---|---|---|
| images | String[] | Yes | The container images to include in the image cache. |
| imagePullSecrets | String[] | No | The Secrets for pulling images from private registries. Specify each Secret in the namespace:secretName format. |
| imageCacheSize | Int | No | The size of the cloud disk used for the image cache, in GB. Valid values: 20–32768. Default value: 20. |
| retentionDays | Int | No | The number of days to retain the image cache. Valid values: 1–65536. If not set, the image cache does not expire. |
ImageCacheStatus
| Parameter | Type | Description |
|---|---|---|
| phase | String | The current lifecycle phase of the image cache, such as Ready. |
| progress | String | The creation progress of the image cache, expressed as a percentage (for example, 100%). |
| imageCacheId | String | The ID of the image cache. |
| startTime | Time | The time when the image cache started being created. |
| lastUpdatedTime | Time | The time when the image cache was last updated. |
| events | Event[] | The events generated during image cache creation. |
| expireDateTime | Time | The time when the image cache expires. An image cache may expire at one of the following points in time: the end of the retention period set at creation, or 24 hours after a failed creation. |
CreateImageCache
Creates an image cache by pulling the specified images onto a cloud disk. Use this operation to pre-cache images before launching Pods, which reduces startup latency.
HTTP request
POST /apis/eci.alibabacloud.com/v1/imagecachesRequest example
curl -X POST -H 'Content-Type: application/yaml' --data '
apiVersion: eci.alibabacloud.com/v1
kind: ImageCache
metadata:
name: imagecache-secrets-test
spec:
images:
- registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0
imagePullSecrets:
- default:acr-test
' http://127.0.0.1:8001/apis/eci.alibabacloud.com/v1/imagecachesResponse example
{
"apiVersion": "eci.alibabacloud.com/v1",
"kind": "ImageCache",
"metadata": {
"creationTimestamp": "2019-10-10T03:50:47Z",
"generation": 1,
"name": "imagecache-secrets-test",
"resourceVersion": "647052328",
"selfLink": "/apis/eci.alibabacloud.com/v1/imagecaches/imagecache-secrets-test11",
"uid": "2506ba37-eb11-11e9-9576-f2ef49bf****"
},
"spec": {
"imagePullSecrets": [
"default:acr-test"
],
"images": [
"registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0"
]
}
}ListImageCache
Queries all image caches in the current cluster.
HTTP request
GET /apis/eci.alibabacloud.com/v1/imagecachesRequest example
curl -X GET 'http://127.0.0.1:8001/apis/eci.alibabacloud.com/v1/imagecaches'Response example
{
"apiVersion": "eci.alibabacloud.com/v1",
"kind": "ImageCacheList",
"metadata": {
"continue": "",
"resourceVersion": "647062964",
"selfLink": "/apis/eci.alibabacloud.com/v1/imagecaches"
},
"items": [
{
"apiVersion": "eci.alibabacloud.com/v1",
"kind": "ImageCache",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"eci.alibabacloud.com/v1\",\"kind\":\"ImageCache\",\"metadata\":{\"annotations\":{},\"name\":\"imagecache-secrets-test\"},\"spec\":{\"imagePullSecrets\":[\"default:acr-test\"],\"images\":[\"registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0\"]}}\n"
},
"creationTimestamp": "2019-10-10T01:43:48Z",
"generation": 1,
"name": "imagecache-secrets-test",
"resourceVersion": "646375979",
"selfLink": "/apis/eci.alibabacloud.com/v1/imagecaches/imagecache-secrets-test",
"uid": "67460461-eaff-11e9-9774-b2c06862****"
},
"spec": {
"imagePullSecrets": [
"default:acr-test"
],
"images": [
"registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0"
]
},
"status": {
"imageCacheId": "imc-2ze5xnx4yiply807****",
"lastUpdatedTime": "2019-10-10T01:47:14Z",
"phase": "Ready",
"progress": "100%",
"startTime": "2019-10-10T01:43:49Z"
}
}
]
}GetImageCache
Queries the details of a single image cache by name, including its current phase, creation progress, and expiration time.
HTTP request
GET /apis/eci.alibabacloud.com/v1/imagecaches/{name}Request example
curl -X GET 'http://127.0.0.1:8001/apis/eci.alibabacloud.com/v1/imagecaches/imagecache-secrets-test'Response example
{
"apiVersion": "eci.alibabacloud.com/v1",
"kind": "ImageCache",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"eci.alibabacloud.com/v1\",\"kind\":\"ImageCache\",\"metadata\":{\"annotations\":{},\"name\":\"imagecache-secrets-test\"},\"spec\":{\"imagePullSecrets\":[\"default:acr-test\"],\"images\":[\"registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0\"]}}\n"
},
"creationTimestamp": "2019-10-10T01:43:48Z",
"generation": 1,
"name": "imagecache-secrets-test",
"resourceVersion": "646375979",
"selfLink": "/apis/eci.alibabacloud.com/v1/imagecaches/imagecache-secrets-test",
"uid": "67460461-eaff-11e9-9774-b2c06862****"
},
"spec": {
"imagePullSecrets": [
"default:acr-test"
],
"images": [
"registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0"
]
},
"status": {
"imageCacheId": "imc-2ze5xnx4yiply807****",
"lastUpdatedTime": "2019-10-10T01:47:14Z",
"phase": "Ready",
"progress": "100%",
"startTime": "2019-10-10T01:43:49Z"
}
}DeleteImageCache
Deletes an image cache by name.
HTTP request
DELETE /apis/eci.alibabacloud.com/v1/imagecaches/{name}Request example
curl -X DELETE -H 'Content-Type: application/yaml' 'http://127.0.0.1:8001/apis/eci.alibabacloud.com/v1/imagecaches/imagecache-secrets-test'Response example
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Success",
"details": {
"name": "imagecache-secrets-test",
"group": "eci.alibabacloud.com",
"kind": "imagecaches",
"uid": "67460461-eaff-11e9-9774-b2c06862****"
}
}