CoreOS 配置工具已由 Ignition
代替 cloud-config
。
GitHub:https://github.com/coreos/ignition
使用 Ignition
需要两步:
第一步编写
Container Linux Config
(yaml
格式 )第二步使用
container-linux-config-transpiler
将Container Linux Config
转化为Ignition Config
(json
格式)
1 | $ ct-v0.5.0-x86_64-apple-darwin -in-file ignition.yaml > ignition.json |
container-linux-config-transpiler
安装方法
在 https://github.com/coreos/container-linux-config-transpiler/releases 下载二进制文件移入 PATH
,并赋予可执行权限之后即可使用。
brew
1 | $ brew install coreos-ct |
官方文档:https://coreos.com/os/docs/latest/overview-of-ct.html
常用配置举例
etcd
1 | etcd: |
网络配置
通过与网络接口名称( enp0s3
等)匹配来设置静态或动态 IP 地址
1 | networkd: |
用户
1 | passwd: |
systemd unit
1 | systemd: |
文件
1 | storage: |
示例文件
https://github.com/khs1994-docker/lnmp-k8s/blob/master/coreos/disk/example/ignition-1.example.yaml