CoreOS安装

1、需要的工具

当前最新稳定版2303.3.0,

地址:https://coreos.com/releases/

下载地址: https://stable.release.core-os.net/amd64-usr/current/  

启动镜像: coreos_production_iso_image.iso

安装包: coreos_production_image.bin.bz2

数字签名文件: coreos_production_image.bin.bz2.sig 

 

配置文档生成器工具:Container Linux Config Transpiler(ct),

下载地址: https://github.com/coreos/container-linux-config-transpiler/releases

 

http服务器:nginx;

在web目录下创建以coreos版本号为名称的文件夹2303.3.0,放入安装包和签名文件;

2、准备ignition文件

首先生成密钥文件,ssh-keygen -t rsa,

复制id_rsa.pub中的内容(以ssh-rsa开头的字符串);

编写yaml文件(旧式的cloud init文件),最简单的配置文件如下:

 

passwd:

  users:

    - name: core

      groups:

        - wheel

        - docker

      ssh_authorized_keys:

        - ssh-rsa ... (以ssh-rsa开头的字符串)

 

生成ignition文件(本例中为node0.json):

ct -in-file node0.yaml -out-file node0.json

把生成的node0.json复制到web目录;

3、开始安装

使用启动镜像启动(不支持UEFI,只能是BIOS);

切换到root账号: sudo su;

下载ignition文件: wget http://IP/.../node0.json

安装: coreos-install -d /dev/sda -i node0.json -b http://IP/...

参数说明:

-d device

-i ignition config

-b base url

 

安装完成,重启。

 

4、远程登录

eval $(ssh-agent)

ssh-add

ssh core@ip

 

5、使用技巧

在不重装的情况下重新配置CoreOS

  1. 在/boot/coreos 下,创建名为first_boot空文档;
  2. 使用新的ignition文件覆盖/usr/share/oem/config.ign;
  3. 重启;

/usr/share/oem/config.ign的内容是最初安装时ignition.json 的内容;



附本人使用的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 ... (以ssh-rsa开头的字符串)

    

storage:

  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://3ojlytcq.mirror.aliyuncs.com","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

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值