YAMAGUCHI::weblog

海水パンツとゴーグルで、巨万の富を築きました。カリブの怪物、フリーアルバイター瞳です。

Jaeger のall-in-oneコンテナを最速で公開する

はじめに

分散トレースのバックエンドのOSSとしては Zipkin とならんで Jaeger が有名です。Jaegerは複数のコンポーネントから成立していますが、それらをきちんとプロダクション環境用にセットアップしようとするとストレージをきちんと用意したり Docker Compose などを使う必要があります。しかし、自分の用途だとデモ用などに使う all-in-one のコンテナ( jaegertracing/all-in-one )をさっと上げて公開したいことがあり、どうするのが一番手数が少ないか考えた結果次のようになりました。

やってみた

$ gcloud compute firewall-rules create jaeger-rules \
    --allow udp:5775,udp:6831,udp:6832,tcp:5778,tcp:16686,tcp:14268,tcp:9411 \
    --direction ingress \
    --priority 1000 \
    --target-tags jaeger

Creating firewall...⠏Created [https://www.googleapis.com/compute/v1/projects/playground-219502/global/firewalls/jaeger-rules].
Creating firewall...done.
NAME          NETWORK  DIRECTION  PRIORITY  ALLOW                                                             DENY  DISABLED
jaeger-rules  default  INGRESS    1000      udp:5775,udp:6831,udp:6832,tcp:5778,tcp:16686,tcp:14268,tcp:9411        False


$ gcloud compute instances create-with-container jaeger-vm \
    --preemptible \
    --container-image jaegertracing/all-in-one:1.14 \
    --boot-disk-size 30GB \
    --tags jaeger

WARNING: You have selected a disk size of under [200GB]. This may result in poor I/O performance. For more information, see: https://developers.google.com/compute/docs/disks#performance.
Created [https://www.googleapis.com/compute/v1/projects/playground-219502/zones/asia-southeast1-b/instances/jaeger-vm].
WARNING: Some requests generated warnings:
 - Disk size: '30 GB' is larger than image size: '10 GB'. You might need to resize the root repartition manually if the operating system does not support automatic resizing. See https://cloud.google.com/compute/docs/disks/add-persistent-disk#resize_pd for details.

NAME       ZONE               MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS
jaeger-vm  asia-southeast1-b  n1-standard-1  true         10.148.0.3   XX.XXX.XXX.XXX  RUNNING

立ち上がったので適当に curl でJaeger UIの疎通確認をしてみます。

$ curl -I http://XX.XXX.XXX.XXX:16686/
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Date: Tue, 08 Oct 2019 05:56:03 GMT

できた。だいたい1分かからないくらいで公開できました。

決してプロダクション環境用ではないので使ったらすぐに落とすこと。