0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Kong GatewayのData Planeを識別しやすくする

0
Posted at

小ネタ。
あまりない悩みかもしれないが、Kong GatewayでData Planeをいろんなところで立てるとどこに立てたか分からなくなる人がいる(私)。
調べようにもHostのところに表示されるのはコンテナ名やPod名だったりして、どこのサーバ・クラスタに立てたものか記憶に頼らざるを得なくなる。
image.png

そんな時に便利なのがkong.confで設定できるcluster_dp_labelsだ。
名前の通り、Data Plane起動時にラベルを付与することが出来る。
例えばdocker-compose.yamlに以下のように書いておく。

services:
  kong:
    environment:
      KONG_CLUSTER_DP_LABELS: deployment:mac-local,IP:${CURRENT_IP}

そして.bashrcに自身のIPなどをタグに表示したいものを環境変数で設定しておく。

export CURRENT_IP=$(ip a show dev en0 |grep -w inet |awk '{print $2'} | sed "s@/.*@@g")

この状態で起動すると以下のようにData Planeにラベルが付与される。
image.png

ラベルはIPに限らず何でもいいので、スペックなりリージョンなり好きなものを設定するとよい。
普段ServiceやRouteなどのエンティティにタグを貼るのはやると思うが、DPはdeckで操作するものでなくこの手の設定は忘れがちなので、よく使う起動設定に常に入れておくといいと思う。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?