ユーザ用ツール

サイト用ツール


サイドバー

プログレス合同会社

広告

server:coreos:install:container-linux-config

構成ファイル

CoreOSの構成ファイルはcloud-config.yamlが非推奨となり、ignition.jsonで行うようになりました。
ただ、json形式だと記述しづらいのでyaml形式のcontainer-linux-config.yamlで記述して、インストール時にjson形式に変換することにします。

passwd

coreユーザーのパスワードとSSHログイン用の公開鍵を設定します。
<html>

passwd:

users:
- name:          core
  password_hash: "<span style="color:red;">{CORE_PASSWORD}</span>"          …(1)
  ssh_authorized_keys:
  - "<span style="color:red;">…(coreユーザーのSSHログイン用公開鍵)…</span>"

(1) {CORE_PASSWORD}は<a href=“/public/doku.php/server/coreos/install/index.html#構成ファイルの変換” class=“wikilink1” title=“server:coreos:install:index.html”>構成ファイルの変換</a>で置き換えます

</html>

networkd

弊社ではConoHa VPSの契約サーバー間をConoHaのプライベートネットワークで接続しています。
プライベートネットワークのネットワーク情報を定義します。
<html>

networkd

units:
- name: 10-static-eth1.network
  contents: |
    [Match]
    Name=eth1
    [Network]
    Address=<span style="color:red;">192.168.111.1</span>/24   …(1)

(1) ConoHaのプライベートネットワークで割り当てられたIPアドレスを指定します

</html>

storage

CoreOSのインストールや起動に必要なファイルを定義します。
<html>

storage:

files:
- path:       /etc/udev/rules.d/90-configdrive.rules     …(1)
  filesystem: root
  mode:       0644
  contents:
    inline:   ""
- path:       /etc/hostname                              …(2)
  filesystem: root
  mode:       0644
  contents:
    inline:   "<span style="color:red;">master</span>"
- path:       /etc/ssh/sshd_config                       …(3)
  filesystem: root
  mode:       0600
  contents:
    inline: |
      PermitRootLogin        no                          …(4)
      AllowUsers             core
      PasswordAuthentication no                          …(5)
      ChallengeResponseAuthentication no
      GSSAPIAuthentication   no
      MaxAuthTries           1
      ClientAliveInterval    60
      UseDNS                 no
- path:       /etc/systemd/timesyncd.conf                …(6)
  filesystem: root
  mode:       0644
  contents:
    inline: |
      [Time]
      NTP=ntp.nict.jp ntp.jst.mfeed.ad.jp

(1) ConoHa VPSにおいてhostnameやsshdの設定内容を反映させるために必要です<br>
(2) hostnameを設定します<br>
(3) sshのログイン方法等を設定します<br>
(4) rootユーザーでのログインを禁止します<br>
(5) パスワードによるログインを禁止します<br>
(6) 時刻同期に使用するNTPサーバーを設定します

</html>

構成ファイルの適用

構成ファイルは構成ファイルの変換でYAML形式のcontainer-linux-config.yamlからJSON形式のignition.jsonに変換してからCoreOSのインストールを行います。

ignition.jsonはCoreOSの初回起動時の1回のみ読み込まれます。
CoreOSのインストール後(初回起動後)に構成ファイルを変更する必要が生じて、変換したignition.jsonを再適用させたい場合は初回起動時の状態にしてCoreOSを再起動します。
<html>

$ sudo cp -f ignition.json /usr/share/oem/coreos-install.json
$ sudo touch /run/systemd/first-boot
$ sudo rm /etc/machine-id
$ sudo reboot

</html>

謝辞

執筆およびサーバー構築にあたり下記のサイトを参考にさせていただきました。
貴重で有意義な情報ありがとうございます。

server/coreos/install/container-linux-config.txt · 最終更新: 2018/09/12 by プログレス合同会社