LoginSignup
4
4

More than 5 years have passed since last update.

fleetctl 使用時の注意点

Last updated at Posted at 2015-10-17

fleetctl を使用する際の注意点

fleetサービスはetcd(ver1/2)において稼働する、cluster / proxyに対して、systemdの操作を簡易的に行える大変素晴らしいサービスです!

ただある設定が抜けていたり、etcd(クラスタ)が不調な場合、fleetctlからsystemdの登録ができないなどの事象が発生します。

では早速、自分のPC中で行っている設定を公開いたします。

fleetctl 基本登録について

通常は以下のようなコマンドを叩いて、Unitサービスを登録していきます。

fleet
fleetctl --tunnel 192.168.0.10 submit nginx-web@1 # systemdファイルを配置しますよ!
fleetctl --tunnel 192.168.0.10 load nginx-web@1 # chkconfigでいう 起動時onの設定にしますよ!
fleetctl --tunnel 192.168.0.10 start nginx-web@1 # systemdを起動しますよ!

ここで出てくるのがtunnelのclusterのIP指定。これが煩わしく、私の.bash_profileには以下の設定を埋め込んでいます。

.bash_profile
eval "$(rbenv init -)" #ssh-addコマンド失敗をさけるため、evalチェックします。
ssh-add ~/.ssh/id_rsa #鍵情報を先に読み込みます
export FLEETCTL_SSH_USERNAME=core #fleetctlを動作させる時のuser名を指定します。
export FLEETCTL_TUNNEL=192.168.0.10 #--tunnelのIPを指定します。

上記のように設定し、下記のように読み込めば、煩わしい設定が不要になります。

$ source ~/.bash_profile

fleet
fleetctl submit nginx-web@1
fleetctl load nginx-web@1
fleetctl start nginx-web@1

あら、タイピング量が減って楽ですね。

但し!気をつけないといけないのが、「export FLEETCTL_TUNNEL=192.168.0.10」として固定していること

万一、192.168.0.10のサービスが完全ダウンしてしまうと、fleetctlコマンドが効かなくなってしまいます。

その場合は改めて、clusterのほかIPアドレスをFLEETCTL_TUNNELの環境変数に登録してください。

前回記事ご紹介:

【CoreOS】冗長化構成 Keepalived+NginxLB+NginxWEB(完)
【CoreOS】冗長化構成 Keepalived+NginxLB+NginxWEB(1)
【CoreOS】fleet + docker + keepalived(VRRP+VIPのみ)で簡単LB
【CoreOS】cloud-config解説〜インストール
Mac + Virtualbox + CoreOS + etcd2 + fleet の基本設定(1)
Mac + Virtualbox + CoreOS + etcd2 + fleet の基本設定(2)
Mac + Virtualbox + CoreOS + etcd2 + fleet の基本設定(完)

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4