准备引导文件
wget https://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz
wget https://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz.sig
wget https://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz
wget https://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz.sig
gpg --verify coreos_production_pxe.vmlinuz.sig
gpg --verify coreos_production_pxe_image.cpio.gz.sig
CoreOS在线版
首次启动使用的ignition文件:
storage:
# 分区
disks:
- device: /dev/sda
wipe_table: true #清空分区表
partitions:
- label: ROOT
# 格式化
filesystems:
- mount:
device: /dev/disk/by-partlabel/ROOT
format: ext4
wipe_filesystem: true #格式化
label: ROOT
添加distro和profile
cobbler distro add --name=CoreOS-x64 --kernel=/root/dist/coreos_pxe.vmlinuz --initrd=/root/dist/coreos_pxe_image.cpio.gz --kopts="coreos.first_boot=1 coreos.config.url=http://192.168.0.130/coreos/pxe-node0.json root=/dev/sda1"
touch /var/lib/cobbler/kickstarts/CoreOS-x64.xml
cobbler profile add --name=CoreOS-x64 --distro=CoreOS-x64 --kickstart=/var/lib/cobbler/kickstarts/CoreOS-x64.xml
同步cobbler sync
CoreOS安装版
添加distro和profile
cobbler distro add --name=CoreOS-x64-install --kernel=/root/dist/coreos_pxe.vmlinuz --initrd=/root/dist/coreos_pxe_image.cpio.gz --kopts="coreos.autologin"
cobbler profile add --name=CoreOS-x64-install --distro=CoreOS-x64-install --kickstart=/var/lib/cobbler/kickstarts/CoreOS-x64.xml
同步cobbler sync
附本人使用的pxe-node0.yaml
# https://coreos.com/os/docs/2303.3.0/configuration.html
passwd:
users:
# 新建账号 core
- name: core
groups:
- wheel
- docker
ssh_authorized_keys:
- ssh-rsa ...
storage:
# 分区
disks:
- device: /dev/sda
wipe_table: true
partitions:
- label: ROOT
# 格式化
filesystems:
- mount:
device: /dev/disk/by-partlabel/ROOT
format: ext4
wipe_filesystem: true
label: ROOT
files:
# 修改计算机名为node0
- path: /etc/hostname
filesystem: root
contents:
inline: node0
mode: 0644
# 修改docker镜像地址
- path: /etc/docker/daemon.json
filesystem: root
contents:
inline: '{"registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]}'
mode: 0644
# 一些常用的alias
- path: /etc/bash/bashrc.d/alias
filesystem: root
contents:
inline: |
alias vi='vim'
alias ping='ping -c 4'
alias q='exit'
alias df='df -Th'
alias free='free -m'
alias ll='ls -lh'
alias hg='shutdown -h now'
mode: 0644
systemd:
units:
# 开机启动docker服务
- name: docker.service
enabled: true