答案1
CoreOS 文档列出了查找云配置文件的各种位置,具体取决于 CoreOS 实例的配置方式和位置。由于我自己正在解决这个问题,因此我将云配置文件添加到其中一个位置,/var/lib/coreos-install/user_data
如下所示:
#cloud-config
coreos:
locksmith:
window-start: Fri 10:00
window-length: 2h
当我重新启动实例时,我发现systemctl status locksmithd
我的配置似乎生效了
ip-172-23-109-250 core # systemctl status locksmithd
● locksmithd.service - Cluster reboot manager
Loaded: loaded (/usr/lib/systemd/system/locksmithd.service; disabled; vendor preset: disabled)
Drop-In: /run/systemd/system/locksmithd.service.d
└─20-cloudinit.conf
Active: active (running) since Fri 2018-03-02 00:36:48 UTC; 1min 37s ago
Main PID: 878 (locksmithd)
Tasks: 4 (limit: 32768)
CGroup: /system.slice/locksmithd.service
└─878 /usr/lib/locksmith/locksmithd
Mar 02 00:36:48 ip-172-23-109-250.us-west-2.compute.internal systemd[1]: Started Cluster reboot manager.
Mar 02 00:36:49 ip-172-23-109-250.us-west-2.compute.internal locksmithd[878]: Reboot window start is "Fri 10:00" and length is "2h"
Mar 02 00:36:49 ip-172-23-109-250.us-west-2.compute.internal locksmithd[878]: Next window begins at 2018-03-02 10:00:00 +0000 UTC and ends at 2018-03-02 12:00:00 +0000 UTC
Mar 02 00:36:49 ip-172-23-109-250.us-west-2.compute.internal locksmithd[878]: locksmithd starting currentOperation="UPDATE_STATUS_IDLE" strategy="reboot"
由于我使用 kops 配置 CoreOS 实例,它会为自己的 shell 脚本保留 Ec2 元数据云配置文件位置,因此我必须为自己的云配置添加这个额外空间。看来 CoreOS 能够提取这两个配置。
或者,你可以使用以下命令声明自己的云配置路径sudo coreos-cloudinit --from-file=/home/core/cloud-config.yaml