When you use an Elastic Container Instance (ECI) to provide long-term services, you can use reserved instances to deduct the costs of the ECI. This topic describes how to use reserved instances.
Preparations
- Purchase reserved instances based on your needs. For more information, see Purchase reserved instances.
- View and manage your reserved instances. For more information, see Split a reserved instance.
Usage
A reserved instance is only applicable when you create an ECI based on a specified ECS instance type. For more information, see Create an ECI from a specified ECS instance type.
Add the following annotations to the templte
field of a pod. In this example, the reserved instance is used to purchase an ecs.c5.large
instance.
annotations:
k8s.aliyun.com/eci-instance-type : "ecs.c5.large" #Replace the value with the ECS instance type in the following format: ecs. instance family. instance specification. For example, ecs.c6.3xlarge.
annotations
must be added to the spec
field of the pod. Enter the ECS instance type as needed. For more information about
supported ECS instance types, see Instance families.
Deployment example
annotations
must be added to the metadata
field of the pod.
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
annotations:
k8s.aliyun.com/eci-instance-type : "ecs.c5.large" #Replace the value with the ECS instance type as needed.
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
View billing and deduction details about a reserved instance
View the bill of a reserved instance