CoreOS 初始化配置
Container Linux (formerly CoreOS Linux) is an open-source lightweight operating system based on the Linux kernel and designed for providing infrastructure to clustered deployments, while focusing on automation, ease of application deployment, security, reliability and scalability. As an operating system, Container Linux provides only the minimal functionality required for deploying applications inside software containers, together with built-in mechanisms for service discovery and configuration sharing.
各个虚拟主机平台上基本都有 CoreOS 系统,但是 Aliyun 上的 ECS 就是有问题的,在用 docker build
的时候总出问题,在 Docker 的仓库中有这些讨论,最终的解决方法就是:
|
|
升级通道
定义了 CoreOS 每次升级的目标版本号。官方提供了三个升级通道,分别为 Alpha、Beta 和 Stable,简单来说就是每个大版本升级的内测、公测和正式发行版。只不过 CoreOS 目前是采用一个不断增加的数字来表示各个版本号,数字越大则相对版本越高。
各通道发布更新的频率依次为(官方目标数据,实际可能不准时):
- Alpha:每周星期四发布
- Beta:每两周发布一次
- Stable:每个月发布一次
每个通道当前的具体版本号可以在这个网页上查看到。关于升级通道,这篇文档有更详细的介绍。
如果你想切换系统所在发布通道的话可以修改文件 /etc/coreos/update.conf
中的 GROUP=beta
。
然后重启一下 update-engine 服务 systemctl restart update-engine
升级策略
关系到系统自动升级后用户是否需要手工重启。它的值可以是 best-effort(默认值)、 etcd-lock、 reboot 和 off。其作用依次解释如下:
- best-effort:如果Etcd运行正常则相当于 etcd-lock,否则相当于 reboot
- etcd-lock:自动升级后自动重启,使用 LockSmith 服务调度重启过程
- reboot:自动升级后立即自动重启系统
- off:自动升级后等待用户手工重启
升级通道和升级策略都可以在系统启动时的 cloud-config 中的 coreos.update 中配置,例如:
|
|
对于已经启动的集群,可以在 /etc/coreos/update.conf
配置文件中修改,其内容格式如下:
|
|
修改完成后需要重启一下 update-engine 服务:systemctl restart update-engine
。
用户手动执行升级一般是没有必要滴。当然如果你非要这么做,也非常简单,命令是 update_engine_client -update
。如果只是想查看一下有没有新版本,可以换个参数 update_engine_client -check_for_update
。
添加账户
useradd -U -m tosone -G sudo
,添加一个新的账户,passwd tosone
。
赋予 sudo
权限,visudo -f /etc/sudoers.d/user1
添加这样一行: tosone ALL=(ALL) NOPASSWD: ALL
。
验证:
|
|
toolbox
toolbox is a small script that launches a container to let you bring in your favorite debugging or admin tools. There are currently two scripts that live within this repository:
- toolbox: designed for Container Linux, uses rkt and systemd-nspawn
- rhcos-toolbox: designed for Red Hat CoreOS, uses podman
|
|
Automatically enter toolbox on login. Set an /etc/passwd
entry for one of the users to /usr/bin/toolbox
:
|
|
Now when SSHing into the system as that user, toolbox will automatically be started:
|
|
Install docker-compose
|
|