使用Cobbler引导CoreOS(PXE方式)

准备引导文件

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值