「入門監視」からetcdの話

昨日に続き、「入門監視」に出てたキーワードから。一見、監視と関係なさそうなetcdだが、まずは読んでみよう。

etcd is a distributed key value store that provides a reliable way to store data across a cluster of machines. It’s open-source and available on GitHub. etcd gracefully handles leader elections during network partitions and will tolerate machine failure, including the leader.

etcdは分散KVSだと言っているが、名前が示すように各サーバのetcに配置されるような設定データを更新する仕組みだ。

Welcome to the temporary home of etcd! As a member of the CNCF family of projects, etcd will soon be getting its own home at etcd.io. Until that's ready, you can find the documentation for etcd here, and you can read about the move to the CNCF from us, from Red Hat, and from the CNCF.

URLとロゴからわかるように、etcdはCoreOSというコンテナに特化した軽量Linuxのプロジェクトの一部だが、CoreOSはRed Hatに買収され、etcdはCNCFにホストされる。

ところで入門監視ではetcdは「2.2.1 監視サービスのコンポーネント」でデータ収集のところに出てくる。etcdで、どうやってデータ収集するのか調べたところ、同じくCoreOSのプロダクトであるflannelが関係するようだ。

flannel is a virtual network that gives a subnet to each host for use with container runtimes. Platforms like Google's Kubernetes assume that each container (pod) has a unique, routable IP inside the cluster. The advantage of this model is that it reduces the complexity of doing port mapping.

flannelはコンテナに対してサブネット、つまりネットワーク設定を付与する仕組み。

Once you have pushed configuration JSON to etcd, you can start flanneld. If you published your config at the default location, you can start flanneld with no arguments. Flannel will acquire a subnet lease, configure its routes based on other leases in the overlay network and start routing packets. It will also monitor etcd for new members of the network and adjust the routes accordingly.

etcdによってconfigがpushされflanneldが起動し、サブネットを取得、それをetcdがモニタリングするという流れだ。

主にKubernetesで使われる機能だが、こういったアーキテクチャが分散環境を支えている。「入門監視」では1台ごとに監視エージェントを入れる監視形態から、動的に台数やアドレスが変わる環境への対応が必要であることを示唆している。


この記事が気に入ったらサポートをしてみませんか?