KEDA+AKSã§k8sä¸ã«FaaSãæ§ç¯ãã
5æã«çºè¡¨ãããKEDA(Kubernetes-based Event-driven Autoscaling)ã§ãããAKS(Azure Kubernetes Service)ã®ä¸ã§ãµã¼ãã¼ã¬ã¹ ã®ã¤ãã³ãããªãã³ã³ã³ããã¼ããµãã¼ããããã®ã¨ãã¦ãªã¼ãã³ã½ã¼ã¹ã§Microsoftã¨RedHatãå ±åã§çºè¡¨ãã¾ããã
Kubernetesã®ã¹ã±ã¼ãªã³ã°ã¯ã³ã³ããã®CPUã¨ã¡ã¢ãªæ¶è²»çã«é¢é£ä»ãããã¦ãã¾ãããKEDAã使ãäºã§Azure Functionsãªã©ã®FaaSã¨åæ§ã«ã¤ãã³ãã«å¿ãããªã½ã¼ã¹ã®ãããã¸ã§ãã³ã°ãã¹ã±ã¼ãªã³ã°ãããäºãå¯è½ã«ãªãã¾ããÂ
ç¾ç¶ï¼2019/9/30ç¾å¨ï¼ãµãã¼ãããã¦ããã¤ãã³ãã½ã¼ã¹ã¨ã¹ã±ã¼ã©ã¼ã¯ä»¥ä¸ã«ãªãã¾ãã
- AWS CloudWatch
- AWS Simple Queue Service
- Azure Event Hubâ
- Azure Service Bus Queues and Topics
- Azure Storage Queues
- GCP PubSub
- Kafka
- Liiklus
- Prometheus
- RabbitMQ
- Redis Lists
詳細ãªã©ã¯GitHubãçºè¡¨æã®ããã°ãåç §ãã¦ãã ããã
å®éã«åããã¦ã¿ã
AKSã®æ§ç¯
ããããã®æ¹æ³ã§AKSãæ§ç¯ãã¾ãã
Â
KEDAã®ã¤ã³ã¹ãã¼ã«
Kubernetesã¯ã©ã¹ã¿ã¼ã«helmãã¤ã³ã¹ãã¼ã«
helm init
Helm repoã®ä½æ
helm repo add kedacore https://kedacore.azureedge.net/helm
 Helm repoã®æ´æ°
helm repo update
keda-edge chartã®ã¤ã³ã¹ãã¼ã«
helm install kedacore/keda-edge --devel --set logLevel=debug --namespace keda --name keda
Azure Functions Core Toolsã®ã¤ã³ã¹ãã¼ã«
func kubernetes install --namespace keda
Â
ã¹ãã¬ã¼ã¸ã®ä½æ
ãã¥ã¼ããªã¬ã¼ã§åãããä½ãã®ã§ã¹ãã¬ã¼ã¸ã¢ã«ã¦ã³ãã¨ãã¥ã¼ãä½æ
ã¢ããªã±ã¼ã·ã§ã³ã®ä½æ
ä½æ¥ãã£ã¬ã¯ããªã®ä½æ
mkdir kedaapp & cd kedaapp
ãã£ã¬ã¯ããªã®åæå
optionã¯nodeâjavascriptãé¸æ
func init . --docker
Queueããªã¬ã¼ã®ä½æ
Azure Queue Storage triggerãé¸æ
å称ã¯é©å®å¤æ´
func new
 function.jsonã®ãqueueNameããStorage Queueã®ãã¥ã¼åã¨åããã
{
"bindings": [
{
"name": "myQueueItem",
"type": "queueTrigger",
"direction": "in",
"queueName": "js-queue-items",
"connection": "AzureWebJobsStorage"
}
]
}
local.settings.jsonã®AzureWebJobsStorageã¸ä½æããStorage accountã®Access keysããConnection stringãã³ãã¼ããï¼key1,key2ã©ã¡ãã§ãããï¼
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "node",
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=mystorageaccount;AccountKey=keykey==="
}
}
Â
KEDAã¸ã¢ããªã±ã¼ã·ã§ã³ã®ãããã¤
ã³ãã³ãã«ã¦docker hubã¸ããã·ã¥ããKubernetesã¸ãããã¤ãã
func kubernetes deploy --name kedaqueue --registry <docker-user-id>
Â
 åä½ç¢ºèª
ãªã½ã¼ã¹ãä½æããã¦ãããã¨ã確èªãã
ãã¥ã¼ããã¼ã¿ã«ããä½æããPodãèªåçã«èµ·åããã®ã確èªãã
ä¸è¨ã®ããã«å¦çãå®äºãã¦ãã°ããããã¨Terminatingããã¾ã
Â
æå¾ã«
ã¾ã ãã¼ã¿çã§éçºä¸ã§ãã
ä»å¾CosmosDBãAzure MonitorãIoT Hubãªã©ã®é£æºãäºå®ããã¦ããã®ã§ä»å¾ããã®ãã¿ãªãããã¯ãã§ããï¼
Â