iPXE 模式啟動 CoreOS(簡單、推薦使用)
阿新 • • 發佈:2022-04-29
iPXE
模式啟動 CoreOS
方法比較簡單,無需配置 PXE
所需的伺服器,推薦大家使用。
準備
下載 ipxe.iso
$ wget http://boot.ipxe.org/ipxe.iso
克隆示例配置
克隆示例配置檔案並啟動內網安裝伺服器。
GitHub:https://github.com/khs1994-docker/coreos
$ git clone --depth=1 https://github.com/khs1994-docker/coreos
$ cd coreos
$ docker-compose up # 預設監聽 8080 埠
內網伺服器詳情請參見 CoreOS 安裝服務本地伺服器 Docker 化
放入檔案
在 http://alpha.release.core-os.net/amd64-usr/ 點選版本號或 current
,下載以下檔案:
coreos_production_pxe.vmlinuz
coreos_production_pxe_image.cpio.gz
放入 current
資料夾中。
ipxe.html
開啟示例中的 ipxe.html
,按實際修改 IP
#!ipxe set base-url http://192.168.199.100:8080/current kernel ${base-url}/coreos_production_pxe.vmlinuz initrd=coreos_production_pxe_image.cpio.gz coreos.first_boot=1 coreos.config.url=http://192.168.199.100:8080/pxe/pxe-config.ign console=tty0 console=ttyS0 coreos.autologin=tty1 coreos.autologin=ttyS0 initrd ${base-url}/coreos_production_pxe_image.cpio.gz boot
pxe-ignition.yaml
進入示例中的 ./pxe/
目錄,在 ./pxe/pxe-ignition.yaml
中設定 SSH 公鑰。
systemd:
units:
- name: etcd2.service
enable: true
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-rsa AAAA...
pxe-config.ign
之後使用以下命令轉換為 pxe-config.ign
$ ct-v0.5.0-x86_64-apple-darwin -in-file pxe-ignition.yaml > pxe-config.ign
格式轉換之後可以驗證 pxe-config.ign
https://coreos.com/validate/
啟動虛擬機器
虛擬機器新增 ipxe.iso
ISO 映象之後啟動。
在啟動介面按下 Ctrl+B
,依次輸入以下命令。
iPXE> dhcp
iPXE> chain http://192.168.199.100:8080/ipxe.html
登入
IPXE
方式啟動的 CoreOS 預設沒有密碼,直接在本機登入。
$ ssh core@ip
安裝
之後 安裝到硬碟。