OS images supported by Container Service for Kubernetes (ACK) may not meet your requirements in some scenarios, such as pre-installing softwares, configuring OS kernel settings, and accelerating image deployment. In this case, you can create a custom image from an Elastic Compute Service (ECS) instance, and create a cluster or node pool based on the custom image. After the custom image is created, nodes that are newly added to the node pool will use your custom image by default.
Usage notes
When you create a cluster or node pool based on a custom image, take note of the following items:
You can use only custom images created based on Alibaba Cloud Linux, RHEL 8.x, and CentOS 7.x.
To use this feature, submit an application in the Quota Center console.
Step 1: Create a custom image from an ECS instance
After you create an ECS instance, you can customize the instance by performing operations such as installing software and deploying application environments, and then create a custom image from the instance. Instances that are created by using the custom image contain all the custom items. This eliminates the need to configure the items for new instances.
Log on to the ECS instance and run the following command to delete the specified files. For more information about how to log on to an instance, see Connect to a Linux instance by using a password or key.
chattr -i /etc/acknode/nodeconfig-* rm -rf /etc/acknode systemctl disable ack-reconfig rm -rf /etc/systemd/system/ack-reconfig.service rm -rf /usr/local/bin/reconfig.sh rm -rf /var/lib/cloud
Create a custom image from an ECS instance. For more information, see Create a custom image from an instance.
Step 2: Create nodes from a custom image
Create in a new cluster
When you create a new cluster, you can configure a node pool based on the custom image. After the cluster is created, nodes that are newly added to the default node pool of the cluster will use your custom image by default.
When you create a new cluster, in the Node Pool Configurations step, click Show Advanced Options. In the Custom Image section, select the custom image created in Step 1: Create a custom image from an ECS instance as prompted.
For more information about parameters for creating a cluster, see Create an ACK managed cluster.
Create in a new node pool
When you create a new node pool, you can configure a custom image. After the node pool is created, nodes that are newly added to the node pool will use your custom image by default.
When you create a new node pool, click Show Advanced Options. In the Custom Image area, select the custom image created in Step 1: Create a custom image from an ECS instance as prompted.
For more information about parameters for creating a node pool, see Create a node pool.
References
If you need to facilitate auto scaling in complex scenarios, you can create a custom image optimized for elastic scenarios. For more information, see Create custom images.