LoginSignup
1
0

More than 3 years have passed since last update.

KEDAを使って、SQSのMessage数に応じたAutoScaleを実装してみる。 -構築編-

Last updated at Posted at 2020-06-10

はじめに

4/6に「KEDA」(Kubernetes Event-driven Autoscaling)がCloud Native Computing Foundation(CNCF)プロジェクトに採用されたことが発表されました。

KEDAとは、Kubernetes-based Event Driven Autoscaling Componentの略で、SQSのメッセージ数などに応じてpodをscaleさせる機能を提供します。

そこで今回は、KEDAを使ってEKS上のpod数を、SQSのメッセージ数に応じてAutoScale In/Outさせてみようと思います。

今回は、環境構築までの流れを説明します。

構築手順

事前準備

今回、helmを使ってKEDAをデプロイするため、kubectlを発行する環境にAWSの公式ドキュメントに従ってhelmをインストールしておきます。

$ curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > get_helm.sh
$ chmod 700 get_helm.sh
$ ./get_helm.sh

helmでKEDAをデプロイ

こちらを参考にさせていただきました。
https://keda.sh/docs/1.4/deploy/
https://www.slideshare.net/tsukasakatou9/kubernetes-keda

1.helm repoを追加

$ helm repo add kedacore https://kedacore.github.io/charts
"kedacore" has been added to your repositories

2.helm repoをアップデート

$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "kedacore" chart repository
Update Complete. ⎈ Happy Helming!⎈

3.KEDAのhelm chartをインストール
helmのバージョンを確認します。

$ helm version
version.BuildInfo{Version:"v3.2.1", GitCommit:"fe51cd1e31e6a202cba7dead9552a6d418ded79a", GitTreeState:"clean", GoVersion:"go1.13.10"}

versionが3.xの場合は下記。

$ kubectl create namespace keda
namespace/keda created
$ helm install keda kedacore/keda --namespace keda
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
NAME: keda
LAST DEPLOYED: Wed May 20 13:08:49 2020
NAMESPACE: keda
STATUS: deployed
REVISION: 1
TEST SUITE: None

4.keda-operator podが起動したことを確認

$ kubectl get pods -n keda
NAME                                               READY   STATUS    RESTARTS   AGE
keda-operator-5895ff46b9-vswhs                     1/1     Running   0          3m58s
keda-operator-metrics-apiserver-6774776dbc-p5m2j   1/1     Running   0          3m58s

これで、KEDAが動作するために必要なpodが起動していることが分かります。

最後に

今回は、一旦KEDAを動作させるための環境を用意するところまで説明しました。
次回は実際にSQSと連携さえてpodをAutoScaleIn?Outさせてみようと思います。

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