Download先
SSHログオン用のパスワード設定
rebootした時はもう一度
$sudo passwd core
cloud-configファイルに記載するためにパスワードを手元で生成。
Make Password
$ sudo openssl passwd -1
※設定しようとするパスワードを入力。暗号化済みのものが表示される。これをcloud-config.ymlに記載。
Config file
node01-cloud-config.yml
#cloud-config
# ホスト名
hostname: node01
coreos:
units:
# 静的ネットワーク設定
- name: static.network
runtime: no
content: |
[Match]
Name=ens192 # インタフェース名
[Network]
Address=xxx.xxx.xxx.xxx/xx # IPアドレス/サブネットマスク
Gateway=xxx.xxx.xxx.xxx # デフォルトゲートウェイ
DNS=xxx.xxx.xxx.xxx # 1つめのDNS
DNS=xxx.xxx.xxx.xxx # 2つめのDNS
- name: timezone.service
command: start
content: |
[Unit]
Description=timezone
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ln -sf ../usr/share/zoneinfo/Japan /etc/localtime
users: # ユーザ名を指定(ログインユーザ)
- name: core
passwd: $1$7JJbYswv$lw0lVUsj2aDnr7h2DiIH.1 "$ sudo openssl passwd -1" の結果を貼り付ける。
ssh-authorized-keys:
- "ssh-rsa A..."
groups:
- sudo
- docker
「ssh-authorized-keys:
- "ssh-rsa A」を付け加えることでPassword認証なしでログオン可能に。
$ sudo coreos-install -d /dev/sda -C stable -c node01-cloud-config.yml
$ sudo shutdown -r now
※CDROMマウントを解除することを忘れずに
※DISKを再利用する場合は、fdiskでパーティションを解除したからがオススメ