In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to create custom node images of ACK clusters. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
With the arrival of the cloud native era, there are more and more cloud requirements for users' applications and businesses, and different business scenarios have different requirements for container platforms. One of the very important requirements is to use custom images to create ACK clusters.
ACK allows users to create Kubernetes clusters using custom images. However, when creating packaged custom images, users often encounter the following pain points:
(1) manual operation steps with low efficiency
(2) the history record of image change is missing, which is not convenient for fault location.
(3) unable to verify the custom image and determine whether it meets the requirements of ACK cluster nodes.
Based on the above pain points, we have opened up the ack-image-builder project to help users quickly create custom images that meet the requirements of ACK cluster nodes.
The ack-image-builder project is based on the open source tool HashiCorp Packer and provides default configuration templates and verification scripts.
The steps to create a custom node image of an ACK cluster using the ack-image-builder project are as follows:
1. Install Packer
Select the software version corresponding to the operating system from the official download page, and follow the installation instructions to install and verify packer.
$packer versionPacker v1.4.1
Indicates that packer has been installed successfully.
two。 Define Packer templates
When you create a custom image using Packer, you need to create a template file in JSON format. In this template file, you need to specify the Alicloud Image Builder (generator) and Provisioners (configurator) that create the custom image.
{"variables": {"region": "cn-hangzhou", "image_name": "test_image {{timestamp}}", "source_image": "centos_7_06_64_20G_alibase_20190711.vhd", "instance_type": "ecs.n1.large", "access_key": "{{env `ALICLOUD_ACCESS_ KEY`}}", "secret_key": "{{env `ALICLOUD_SECRET_ KEY`}"} "} "builders": [{"type": "alicloud-ecs", "access_key": "{{user `secret_ key`}}", "secret_key": "{user `secret_ key`}", "region": "{{user `region`}}", "image_name": "{{user `image_ name`}}", "source_image": "{user `source_ image`}" "ssh_username": "root", "instance_type": "{{user `instance_ type`}}", "io_optimized": "true"}], "provisioners": [{"type": "shell", "scripts": ["scripts/updateKernel.sh", "scripts/reboot.sh", "scripts/cleanUpKerneles.sh" "config/default.sh", "scripts/updateDNS.sh", "scripts/verify.sh"], "expect_disconnect": true}]} parameters describe access_key your AccessKeyIDsecret_key your AccessKeySecretregion uses the region of the temporary resource when creating a custom image, the name of the image_name custom image, the name of the basic source_image image The type of temporary instance generated by instance_type when creating a custom image can be obtained from the public image list of Aliyun. The type of Packer configurator used to create a custom image by provisioners. Create a sub-account and generate AK
The permission to create a custom image is relatively high. It is recommended that you create a sub-account, authorize the corresponding RAM Policy required by Packer, and create an AK.
4. Import AK information and make a custom image
Import AK:
Export ALICLOUD_ACCESS_KEY=XXXXXXexport ALICLOUD_SECRET_KEY=XXXXXX
Create a custom image:
$packer build alicloud.jsonalicloud-ecs output will be in this color.== > alicloud-ecs: Prevalidating source region and copied regions...== > alicloud-ecs: Prevalidating image name... Alicloud-ecs: Found image ID: centos_7_06_64_20G_alibase_20190711.vhd== > alicloud-ecs: Creating temporary keypair: xxxxxx== > alicloud-ecs: Creating vpc... Alicloud-ecs: Created vpc: xxxxxx== > alicloud-ecs: Creating vswitch... Alicloud-ecs: Created vswitch: xxxxxx== > alicloud-ecs: Creating security group... Alicloud-ecs: Created security group: xxxxxx== > alicloud-ecs: Creating instance... Alicloud-ecs: Created instance: xxxxxx== > alicloud-ecs: Allocating eip... Alicloud-ecs: Allocated eip: xxxxxx alicloud-ecs: Attach keypair xxxxxx to instance: xxxxxx== > alicloud-ecs: Starting instance: xxxxxx== > alicloud-ecs: Using ssh communicator to connect: 47.111.127.54 percent = > alicloud-ecs: Waiting for SSH to become available...== > alicloud-ecs: Connected to SSH benchmark = > alicloud-ecs: Provisioning with shell script: scripts/verify.sh alicloud-ecs: [20190726 11:04:10]: Check if kernel version > = 3.10. Verify Passed! Alicloud-ecs: [11:04:10]: Check if systemd version > = 219. Verify Passed! Alicloud-ecs: [20190726 11:04:10]: Check if sshd is running and listen on port 22. Verify Passed! Alicloud-ecs: [20190726 11:04:10]: Check if cloud-init is installed. Verify Passed! Alicloud-ecs: [20190726 11:04:10]: Check if wget is installed. Verify Passed! Alicloud-ecs: [20190726 11:04:10]: Check if curl is installed. Verify Passed! Alicloud-ecs: [20190726 11:04:10]: Check if kubeadm is cleaned up. Verify Passed! Alicloud-ecs: [20190726 11:04:10]: Check if kubelet is cleaned up. Verify Passed! Alicloud-ecs: [20190726 11:04:10]: Check if kubectl is cleaned up. Verify Passed! Alicloud-ecs: [20190726 11:04:10]: Check if kubernetes-cni is cleaned up. Verify Passedwaters = > alicloud-ecs: Stopping instance: xxxxxx== > alicloud-ecs: Waiting instance stopped: xxxxxx== > alicloud-ecs: Creating image: test_image1564110199 alicloud-ecs: Detach keypair xxxxxx from instance: xxxxxxx== > alicloud-ecs: Cleaning up' EIP'== > alicloud-ecs: Cleaning up' instance'== > alicloud-ecs: Cleaning up' security group'== > alicloud-ecs: Cleaning up' vSwitch'== > alicloud-ecs: Cleaning up' VPC'== > alicloud-ecs: Deleting temporary keypair...Build 'alicloud-ecs' finished.== > Builds finished. The artifacts of successful builds are:-- > alicloud-ecs: Alicloud images were created:cn-hangzhou: m-bp1aifbnupnaktj00q7s
Scripts/verify.sh is the check part of the check item.
5. Create an ACK cluster using a custom image
Log in to the CCS console, select to create a Kubernetes proprietary cluster, configure the basic information needed for cluster creation, click to display advanced options, and select a custom image to create the cluster.
Thank you for reading! This is the end of this article on "how to make a custom node image of an ACK cluster". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
HDESK hdeskCurrent;HDESK hdesk;HWINSTA hwinstaCurrent;HWINSTA hwinsta;hwinstaCurrent = GetProcessWin
© 2024 shulou.com SLNews company. All rights reserved.