This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
region = "eu-central-1" | |
env = "common" | |
# https://www.davidc.net/sites/default/subnets/subnets.html | |
# each subnet ~8190 hosts | |
# 10.0.192.0/19 is reserved for VPN clients endpoints | |
vpc_cidr = "10.0.0.0/16" | |
vpc_private_subnets = ["10.0.0.0/19", "10.0.32.0/19", "10.0.64.0/19"] | |
vpc_public_subnets = ["10.0.96.0/19", "10.0.128.0/19", "10.0.160.0/19"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_availability_zones" "available" {} | |
module "vpc" { | |
source = "terraform-aws-modules/vpc/aws" | |
version = "3.7.0" | |
name = "${var.env}-vpc" | |
cidr = var.vpc_cidr | |
azs = data.aws_availability_zones.available.names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile added: | |
FROM node:14 | |
RUN apt update && apt install netcat -y | |
WORKDIR /usr/src/app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . | |
EXPOSE 3000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ helm uninstall keda -n keda | |
$ kubectl delete ns keda | |
$ kubectl delete ns nginx-demo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ /usr/local/sbin/rabbitmqadmin -H 192.168.2.101 -u demo -p demo \ | |
purge queue name=demo_queue | |
queue purged | |
$ /usr/local/sbin/rabbitmqadmin -H 192.168.2.101 -u demo -p demo \ | |
list queues | |
+------------+----------+ | |
| name | messages | | |
+------------+----------+ | |
| demo_queue | 0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl get hpa | |
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE | |
keda-hpa-rabbitmq-scaledobject Deployment/nginx-deployment 12/3 (avg) 1 5 2 24m | |
$ kubectl get po | |
NAME READY STATUS RESTARTS AGE | |
nginx-deployment-66b6c48dd5-24qp7 1/1 Running 1 17m | |
nginx-deployment-66b6c48dd5-78d54 1/1 Running 0 38s | |
nginx-deployment-66b6c48dd5-jxtr8 1/1 Running 0 38s | |
nginx-deployment-66b6c48dd5-sl4p8 1/1 Running 0 38s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ for i in {6..12}; do | |
/usr/local/sbin/rabbitmqadmin --host 192.168.2.101 -u demo -p demo \ | |
publish exchange=amq.default routing_key=demo_queue payload="message ${i}" | |
done | |
$ /usr/local/sbin/rabbitmqadmin -H 192.168.2.101 -u demo -p demo \ | |
list queues | |
+------------+----------+ | |
| name | messages | | |
+------------+----------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl get hpa | |
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE | |
keda-hpa-rabbitmq-scaledobject Deployment/nginx-deployment 5/3 (avg) 1 5 1 22m | |
$ kubectl get po | |
NAME READY STATUS RESTARTS AGE | |
nginx-deployment-66b6c48dd5-24qp7 1/1 Running 0 14m | |
nginx-deployment-66b6c48dd5-2d4w2 1/1 Running 0 66s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ for i in {1..5}; do | |
/usr/local/sbin/rabbitmqadmin --host 192.168.2.101 -u demo -p demo \ | |
publish exchange=amq.default routing_key=demo_queue payload="message ${i}" | |
done | |
$ /usr/local/sbin/rabbitmqadmin -H 192.168.2.101 -u demo -p demo \ | |
list queues | |
+------------+----------+ | |
| name | messages | | |
+------------+----------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl get scaledobject | |
NAME SCALETARGETKIND SCALETARGETNAME MIN MAX TRIGGERS AUTHENTICATION READY ACTIVE AGE | |
rabbitmq-scaledobject apps/v1.Deployment nginx-deployment 1 5 rabbitmq keda-trigger-auth-rabbitmq-conn True False 14m | |
$ kubectl get po | |
NAME READY STATUS RESTARTS AGE | |
nginx-deployment-66b6c48dd5-24qp7 1/1 Running 0 3m46s | |
$ kubectl get hpa | |
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE |