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:
Create a custom image based on the operating system supported by the ACK cluster. For more information, see Overview of OS images.
The predefined behavior logic in a custom image may affect operations such as cluster node initialization, container launching, node updates, and automatic recovery of nodes in a managed node pool. Before you use it in a production environment, ensure that the custom image has been tested and validated.
This feature is only available to whitelist users. 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, select Operating System as Custom Image, and click Select a custom image. In the Choose Custom Image dialog box, select the custom image created in Step 1: Create a custom image from an ECS instance as prompted.
For more information about how to configure a cluster during creation, see Create a 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, select Operating System as Custom Image, and click Select a custom image. In the Choose Custom Image dialog, select the custom image created in Step 1: Create a custom image from an ECS instance as prompted.
For more information about how to configure a node pool during creation, 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.