Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to practice config drive

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to carry out the practice of config drive, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, hope you can gain something.

If instance cannot obtain metadata through metadata service (no DHCP or nova-api-metadata services), instance can also obtain metadata through config drive.

Config drive is a special file system, and OpenStack writes metadata to config drive and mounts it to instance when instance starts. If instance installs cloud-init,config drive, it will be automatically mount and read metadata from it, and then complete the subsequent initialization work.

Next we will practice config-drive.

Configuration

Config drive defaults to disable, so you have to enable it first. There are two ways to enable config drive:

Specify-- config-drive true when starting instance.

Configure force_config_drive = true in the / etc/nova/nova.conf of the compute node so that all instance deployed to this compute node will use config drive. This is the method used in our experiment.

Config drive supports two formats, iso9660 and vfat, and the default is iso9660, but this will cause instance to not migrate online and must be set to config_drive_format=vfat to migrate online, which should be noted.

After the configuration is complete, restart the nova-compute service.

Process analysis

To deploy a new cirros instance c2, let's first go to the compute node's instances directory to see the difference between C1 and c2.

There will be an additional disk.config file in the directory of c2, which is config drive. You can see from virsh edit that disk.config has been mounted on instance.

Open the console of c2, and hostname has been configured, indicating that metadata has got it.

To make sure that the metadata is not obtained from nova-api-metadata, I have turned off the DHCP service ahead of time, and you can see that there is no IP in c2.

Lsblk looks at the block device, and the iso device sr0 is config drive.

Mount sr0, view the contents of config drive.

Ssh public key, hostname and other information are stored in meta_data.json.

Instance can get metadata through either nova-api-metadata or config drive.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report