Methods and systems for preloading containers via secondary disks
The disclosure provides a container orchestration system for preloading containers via secondary disks. The container orchestration system includes creating a disk image with preloaded containers. The disk image can include a container image pre-downloaded and pre-unpacked, ready to be used by container runtime. The container orchestration system includes creating a node with the disk image and attaching the disk to a node when a node is created. The container orchestration system further includes reading a container image from the disk. When the node creator configures the disk mode as a local cache, the container orchestration system can read the container image by caching the image from the disk without the image-pulling process.
1 . A method of preloading container images via secondary disks on a node, comprising:
creating a first disk for temporary storage;
pulling one or more container images from an external repository to the first disk;
unpacking the one or more container images to the first disk;
generating, with one or more processors, a disk image of the first disk including a preloaded container for a secondary disk;
creating, with the one or more processors, a node attached to the secondary disk containing the disk image; and
reading, with the one or more processors, the preloaded container from secondary disk during container runtime; and
installing the preloaded container onto the node from the disk image.
2 . The method of claim 1 , wherein the secondary disk is a persistent disk.
3 . The method of claim 1 , wherein the secondary disk is a secondary boot disk.
4 . The method of claim 1 , wherein the disk image is binary data, encapsulating an application and software dependencies.
5 . The method of claim 1 , wherein generating the disk image of the first disk including the preloaded container comprises:
mounting the secondary disk; and
creating a snapshot of the container image from the first disk.
6 . The method of claim 5 , wherein the creating the snapshot of the container image from the first disk comprises:
creating a temporary view of a container image layer;
copying the snapshot into a specific location on the secondary disk; and
creating a metadata file related to the snapshot and the specific location on the secondary disk.
7 . The method of claim 6 , wherein the metadata includes a snapshot identifier and a snapshot path.
8 . The method of claim 1 , further comprising attaching the secondary disk to the node by updating a workload of the node.
9 . The method of claim 8 , wherein the updating the workload of the node comprises specifying a disk identifier (ID) of the secondary disk on a specification of the node.
10 . The method of claim 8 , wherein attaching the secondary disk to the node comprises:
specifying a disk mode of the secondary disk as a local cache; and
appending a mount path of the disk with the specified disk mode on a specification of the node pool.
11 . A system for preloading container images via secondary disks on a node, comprising:
memory; and
one or more processors in communication with the memory, the one or more processors configured to:
create a disk for temporary storage;
pull one or more container images from an external repository to the first disk;
unpack the one or more container images to the first disk;
generate a disk image of the first disk including a preloaded container to a secondary disk;
create a node attached to the secondary disk containing the disk image; and
read the preloaded container from the disk image on the secondary disk during node runtime; and
install the preloaded container onto the node.
12 . The system of claim 11 , wherein the secondary disk is a persistent disk.
13 . The system of claim 11 , wherein the secondary disk is a secondary boot disk.
14 . The system of claim 11 , wherein the disk image is binary data, encapsulating an application and software dependencies.
15 . The system of claim 11 , wherein in generating the disk image of the first disk including the preloaded container the one or more processors are configured to:
mount the secondary disk; and
create a snapshot of the container image from the first disk.
16 . The system of claim 15 , wherein the one or more processors are configured to:
create the snapshot by creating a temporary view of a container image layer;
copy the snapshot into a specific location on the secondary disk; and
create a metadata file related to the snapshot and the specific location on the secondary disk.
17 . The system of claim 16 , wherein the metadata includes a snapshot identifier and a snapshot path.
18 . The system of claim 11 , wherein the one or more processors are configured to attach the secondary disk to the node by updating a workload of the node.
19 . The system of claim 18 , wherein the one or more processors are configured to specify a disk identifier (ID) of the secondary disk on a specification of the node.
20 . The system of claim 18 , wherein the one or more processors are configured to:
specify a disk mode of the secondary disk as a local cache; and
append a mount path of the disk with the specified disk mode on a specification of the node.