Tutorial: Autoscaling an Application with KEDA on Azure Kubernetes Service (AKS)
Read full transcript 12 segments
-
hello and welcome to this tutorial today hello and welcome to this tutorial today I'm going to show you how to work with I'm going to show you how to work with I'm going to show you how to work with kada on Azure kubernetes service and how kada on Azure kubernetes service and how kada on Azure kubernetes service and how to scale your first application I to scale your first application I to scale your first application I recently had to do a pocc for this at recently had to do a pocc for this at recently had to do a pocc for this at work and I found that there weren't any work and I found that there weren't any work and I found that there weren't any real good up-to-date tutorials for this real good up-to-date tutorials for this real good up-to-date tutorials for this and I had to figure it out by myself and and I had to figure it out by myself and and I had to figure it out by myself and there weren't any real step-by-step there weren't any real step-by-step there weren't any real step-by-step guides so I figured I would create one guides so I figured I would create one guides so I figured I would create one and hopefully it will ease your journey and hopefully it will ease your journey and hopefully it will ease your journey as you are learning kubernetes event as you are learning kubernetes event as you are learning kubernetes event driven autoscaling because it's um it's driven autoscaling because it's um it's driven autoscaling because it's um it's easier than it sounds so I have prepared easier than it sounds so I have prepared easier than it sounds so I have prepared a demo demo here on in a repo the link a demo demo here on in a repo the link a demo demo here on in a repo the link will be down in the description and in will be down in the description and in will be down in the description and in here there are some kubernetes resources here there are some kubernetes resources here there are some kubernetes resources and there is a readme file so I'm and there is a readme file so I'm and there is a readme file so I'm opening the read me here and here it opening the read me here and here it opening the read me here and here it will show you it will have all the will show you it will have all the will show you it will have all the commands that we need to do and I also commands that we need to do and I also commands that we need to do and I also have a a kubernetes cluster deployed have a a kubernetes cluster deployed have a a kubernetes cluster deployed it's an AKs it's an AKs it's an AKs cluster and let's open up K9s here here cluster and let's open up K9s here here cluster and let's open up K9s here here there are no pods running except for there are no pods running except for there are no pods running except for cube system and the postgress operator I cube system and the postgress operator I cube system and the postgress operator I will get into that later but the that's will get into that later but the that's will get into that later but the that's all there is running there are no all there is running there are no all there is running there are no applications running on here yet and we applications running on here yet and we applications running on here yet and we are going to deploy an application from are going to deploy an application from are going to deploy an application from scratch and I'll show you how to do scratch and I'll show you how to do scratch and I'll show you how to do it so if we read the read me um this it so if we read the read me um this it so if we read the read me um this will guide you to set up a simple will guide you to set up a simple will guide you to set up a simple application with Autos scale in with application with Autos scale in with application with Autos scale in with kada and for that we need to have an APS
-
kada and for that we need to have an APS kada and for that we need to have an APS cluster well I already have one but you cluster well I already have one but you cluster well I already have one but you can use this command to create one or can use this command to create one or can use this command to create one or you can use this command to enable it on you can use this command to enable it on you can use this command to enable it on an existing cluster it's actually fairly an existing cluster it's actually fairly an existing cluster it's actually fairly easy so the kada is now available as an easy so the kada is now available as an easy so the kada is now available as an official add-on before you could deploy official add-on before you could deploy official add-on before you could deploy it but then you had to install it and it but then you had to install it and it but then you had to install it and maintain it yourself but as it is an maintain it yourself but as it is an maintain it yourself but as it is an add-on it will be automatically updated add-on it will be automatically updated add-on it will be automatically updated with your AKs upgrades so it's really with your AKs upgrades so it's really with your AKs upgrades so it's really nice that Microsoft is supporting that nice that Microsoft is supporting that nice that Microsoft is supporting that now which at the time of recording of now which at the time of recording of now which at the time of recording of this video is only a couple of months this video is only a couple of months this video is only a couple of months ago so let's get started um we are going ago so let's get started um we are going ago so let's get started um we are going to be setting up an a small application to be setting up an a small application to be setting up an a small application that runs a that runs a that runs a database now databases on kubernetes database now databases on kubernetes database now databases on kubernetes it's not as difficult as you think don't it's not as difficult as you think don't it's not as difficult as you think don't worry you can do this this is not very worry you can do this this is not very worry you can do this this is not very uh difficult at all and we're already uh difficult at all and we're already uh difficult at all and we're already going to do a demo here so don't be going to do a demo here so don't be going to do a demo here so don't be scared that we're going to use a scared that we're going to use a scared that we're going to use a database but the thing is that kada database but the thing is that kada database but the thing is that kada needs something to to trigger the auto needs something to to trigger the auto needs something to to trigger the auto scaling scaling scaling right there are several different right there are several different right there are several different scalers can can look at that now so scalers can can look at that now so scalers can can look at that now so there there are uh scalers that are there there are uh scalers that are there there are uh scalers that are driven by rabbit mq driven by rabbit mq driven by rabbit mq lowkey um you can you can Scale based on lowkey um you can you can Scale based on lowkey um you can you can Scale based on CPU you can Scale based on memory reddis CPU you can Scale based on memory reddis CPU you can Scale based on memory reddis but also Azure services such as event but also Azure services such as event but also Azure services such as event hubs or log analytics or Azure pipelines hubs or log analytics or Azure pipelines hubs or log analytics or Azure pipelines and one of these scalers that is and one of these scalers that is and one of these scalers that is possible is also um
-
possible is also um possible is also um postgress so for the PC that I had to do postgress so for the PC that I had to do postgress so for the PC that I had to do at work the use case was that it needed at work the use case was that it needed at work the use case was that it needed to Scale based on a postgress query and to Scale based on a postgress query and to Scale based on a postgress query and that's what I chose um for this demo as that's what I chose um for this demo as that's what I chose um for this demo as well because basically what it does is well because basically what it does is well because basically what it does is that you configure a query and that that you configure a query and that that you configure a query and that query returns a number and if the number query returns a number and if the number query returns a number and if the number is higher than a certain number then you is higher than a certain number then you is higher than a certain number then you are triggering the auto scaling so are triggering the auto scaling so are triggering the auto scaling so that's how the postcript as scaler works that's how the postcript as scaler works that's how the postcript as scaler works and that's what we're also going to be and that's what we're also going to be and that's what we're also going to be doing here today so here is the command doing here today so here is the command doing here today so here is the command to install the EDB operator the to install the EDB operator the to install the EDB operator the Enterprise DB now it's already installed Enterprise DB now it's already installed Enterprise DB now it's already installed on this cluster but I'm going to apply on this cluster but I'm going to apply on this cluster but I'm going to apply it anyway so it's already unchanged as it anyway so it's already unchanged as it anyway so it's already unchanged as you will see but you just apply those you will see but you just apply those you will see but you just apply those and then you have the operator installed and then you have the operator installed and then you have the operator installed on the cluster and this means that you on the cluster and this means that you on the cluster and this means that you can deploy the postgress cluster custom can deploy the postgress cluster custom can deploy the postgress cluster custom resource and then resource and then resource and then we can apply the database. yaml so let's we can apply the database. yaml so let's we can apply the database. yaml so let's take a look in take a look in take a look in there this is what the database. yaml there this is what the database. yaml there this is what the database. yaml looks like first we deploy a namespace looks like first we deploy a namespace looks like first we deploy a namespace called K po or Pock I will call it Po called K po or Pock I will call it Po called K po or Pock I will call it Po from now on and here we have this custom from now on and here we have this custom from now on and here we have this custom resource called cluster and this is resource called cluster and this is resource called cluster and this is going to Simply deploy a database going to Simply deploy a database going to Simply deploy a database postgress database on our kubernetes postgress database on our kubernetes postgress database on our kubernetes cluster it will have three instances and cluster it will have three instances and cluster it will have three instances and it will have a storage size of 200 it will have a storage size of 200 it will have a storage size of 200 megabytes megabytes megabytes so now we're ready to apply the database so now we're ready to apply the database so now we're ready to apply the database at yo I will select this and then I will
-
at yo I will select this and then I will at yo I will select this and then I will navigate to my repo navigate to my repo navigate to my repo here so you just clone this repo on your here so you just clone this repo on your here so you just clone this repo on your system and you CD into the kada system and you CD into the kada system and you CD into the kada postgress directory and here you will postgress directory and here you will postgress directory and here you will have the database. yaml available and have the database. yaml available and have the database. yaml available and then you just do qctl applyf database. then you just do qctl applyf database. then you just do qctl applyf database. yaml and now we are going to be yaml and now we are going to be yaml and now we are going to be deploying a database to our cluster so deploying a database to our cluster so deploying a database to our cluster so if we open up k 9s if we open up k 9s if we open up k 9s here this is the tool that I use to keep here this is the tool that I use to keep here this is the tool that I use to keep track of my kubernetes cluster I am now track of my kubernetes cluster I am now track of my kubernetes cluster I am now in the Kap poo name space and here we in the Kap poo name space and here we in the Kap poo name space and here we see that there is a pod starting to run see that there is a pod starting to run see that there is a pod starting to run with init DB and this is going to start with init DB and this is going to start with init DB and this is going to start up the database cluster so this takes a up the database cluster so this takes a up the database cluster so this takes a few moments so in the meantime let's few moments so in the meantime let's few moments so in the meantime let's just take a look at the next step in the just take a look at the next step in the just take a look at the next step in the read me read me read me file um we are going to be connecting to file um we are going to be connecting to file um we are going to be connecting to the database and then we're going to run the database and then we're going to run the database and then we're going to run some commands in the some commands in the some commands in the database we are going to create some database we are going to create some database we are going to create some schemas and some tables don't worry you schemas and some tables don't worry you schemas and some tables don't worry you don't have to understand what this all don't have to understand what this all don't have to understand what this all does we are just setting up our does we are just setting up our does we are just setting up our application and uh you don't have to application and uh you don't have to application and uh you don't have to know all the details it's just so that know all the details it's just so that know all the details it's just so that we have something to base our scaling on so our first database pot is up and on so our first database pot is up and running so this means that the database running so this means that the database running so this means that the database cluster is actually running now and that cluster is actually running now and that cluster is actually running now and that means that we can continue to with the means that we can continue to with the means that we can continue to with the next step so so let's go and do the cube next step so so let's go and do the cube next step so so let's go and do the cube CTL xac it so this means that we are CTL xac it so this means that we are CTL xac it so this means that we are going to execute command on the Pod so
-
going to execute command on the Pod so going to execute command on the Pod so let me let me let me just do the cube CTL get pods I have an just do the cube CTL get pods I have an just do the cube CTL get pods I have an alias for that kgp so we are in the Nam alias for that kgp so we are in the Nam alias for that kgp so we are in the Nam space and then I will do Cube CTL xac space and then I will do Cube CTL xac space and then I will do Cube CTL xac it and now I'm in the database one it and now I'm in the database one it and now I'm in the database one container that you see here or in the container that you see here or in the container that you see here or in the database one pod I should database one pod I should database one pod I should say in there we are going to run this say in there we are going to run this say in there we are going to run this command psql psql so now I'm in command psql psql so now I'm in command psql psql so now I'm in connected with the postgress connected with the postgress connected with the postgress CLI and in there I'm going to run C app CLI and in there I'm going to run C app CLI and in there I'm going to run C app this means you connect to the database this means you connect to the database this means you connect to the database app as user app as user app as user postgress now the name app is a default postgress now the name app is a default postgress now the name app is a default name that the EDB operator uses for the name that the EDB operator uses for the name that the EDB operator uses for the database name so that's why it's called database name so that's why it's called database name so that's why it's called app now we are now logged into the app app now we are now logged into the app app now we are now logged into the app database and then we're going to run database and then we're going to run database and then we're going to run some commands to uh set up the schema some commands to uh set up the schema some commands to uh set up the schema and now that we have created some T and now that we have created some T and now that we have created some T tables and a schema we are going to run tables and a schema we are going to run tables and a schema we are going to run this command so what does this do it is this command so what does this do it is this command so what does this do it is a loop that will create a a a sort of a loop that will create a a a sort of a loop that will create a a a sort of fake message cue it will create 100 fake message cue it will create 100 fake message cue it will create 100 entries in our database and we're going entries in our database and we're going entries in our database and we're going to pretend this is a message q and to pretend this is a message q and to pretend this is a message q and because we are doing 100 this means that because we are doing 100 this means that because we are doing 100 this means that the length of the queue is going to be the length of the queue is going to be the length of the queue is going to be 100 100 100 and then we're going to configure kada and then we're going to configure kada and then we're going to configure kada to scale our application if our message to scale our application if our message to scale our application if our message cue has a has a length larger than one cue has a has a length larger than one cue has a has a length larger than one so you have to sort of visualize a
-
so you have to sort of visualize a so you have to sort of visualize a message cue where we have lots of jobs message cue where we have lots of jobs message cue where we have lots of jobs waiting for us and then we have only one waiting for us and then we have only one waiting for us and then we have only one pod running right well our application pod running right well our application pod running right well our application the way we are setting it up we want to the way we are setting it up we want to the way we are setting it up we want to make sure that when there's a lot of make sure that when there's a lot of make sure that when there's a lot of messages in the queue then we need to messages in the queue then we need to messages in the queue then we need to scale out our application and and then scale out our application and and then scale out our application and and then each pod can take the messages and do each pod can take the messages and do each pod can take the messages and do the work and and process them and that the work and and process them and that the work and and process them and that will mean that the length of the queue will mean that the length of the queue will mean that the length of the queue is going to decrease and therefore our is going to decrease and therefore our is going to decrease and therefore our application is going to do the work application is going to do the work application is going to do the work scale out scale back down and then um it scale out scale back down and then um it scale out scale back down and then um it won't use any resources while it's on won't use any resources while it's on won't use any resources while it's on the downtime this is the use case that I the downtime this is the use case that I the downtime this is the use case that I had at work and that is something that had at work and that is something that had at work and that is something that we have implemented we have implemented we have implemented so let's run so let's run so let's run this this this and now when we are going to verify this and now when we are going to verify this and now when we are going to verify this postgress query so now we postgress query so now we postgress query so now we are we are going to select the the count are we are going to select the the count are we are going to select the the count from the message queue and now we see from the message queue and now we see from the message queue and now we see that we get returned a number of 100 so that we get returned a number of 100 so that we get returned a number of 100 so now our message cue is 100 messages long now our message cue is 100 messages long now our message cue is 100 messages long that's all we need to configure for our that's all we need to configure for our that's all we need to configure for our database and now now that we have our database and now now that we have our database and now now that we have our database is up and running then we are database is up and running then we are database is up and running then we are going to get a hold of the password for going to get a hold of the password for going to get a hold of the password for the the the database so for that I'm going to just database so for that I'm going to just database so for that I'm going to just open up a second window here because in open up a second window here because in open up a second window here because in or I can do it in this one actually or I can do it in this one actually or I can do it in this one actually because in this one this is now our
-
because in this one this is now our because in this one this is now our database pod we are connected to the database pod we are connected to the database pod we are connected to the database pod and I need to keep that database pod and I need to keep that database pod and I need to keep that open for now so I'm going to go to this open for now so I'm going to go to this open for now so I'm going to go to this window and I'm going to window and I'm going to window and I'm going to then copy this then copy this then copy this command and I'm going to be running that command and I'm going to be running that command and I'm going to be running that now what this does is that it takes the now what this does is that it takes the now what this does is that it takes the secret that was created by the database secret that was created by the database secret that was created by the database operator for our database and it takes operator for our database and it takes operator for our database and it takes out the the password for it this is just out the the password for it this is just out the the password for it this is just a demo you should never do this in a demo you should never do this in a demo you should never do this in production of course but then I'm going production of course but then I'm going production of course but then I'm going to be opening the the deployment. yaml to be opening the the deployment. yaml to be opening the the deployment. yaml this is our fake application and here this is our fake application and here this is our fake application and here there is a password environment variable there is a password environment variable there is a password environment variable and we're just going to paste that in and we're just going to paste that in and we're just going to paste that in like that so if we are going if we just like that so if we are going if we just like that so if we are going if we just take a quick look at the deployment this take a quick look at the deployment this take a quick look at the deployment this is just a deployment with httpd front is just a deployment with httpd front is just a deployment with httpd front end it is a very simple pod it's it's end it is a very simple pod it's it's end it is a very simple pod it's it's nothing it's just a pod to run something nothing it's just a pod to run something nothing it's just a pod to run something it doesn't do anything really but it's it doesn't do anything really but it's it doesn't do anything really but it's just to get have something running on just to get have something running on just to get have something running on our cluster so we can pretend that we our cluster so we can pretend that we our cluster so we can pretend that we are scaling up and down a uh application are scaling up and down a uh application are scaling up and down a uh application but it's very important that the PG but it's very important that the PG but it's very important that the PG password environment variable is set password environment variable is set password environment variable is set because kada is going to be using this because kada is going to be using this because kada is going to be using this in production you're going to be using a in production you're going to be using a in production you're going to be using a Secrets operator in order to securely um Secrets operator in order to securely um Secrets operator in order to securely um have your secrets available in your have your secrets available in your have your secrets available in your pods so now we have adjusted the
-
pods so now we have adjusted the pods so now we have adjusted the deployment file and then we can apply deployment file and then we can apply deployment file and then we can apply the deployment file the deployment file the deployment file by running this command Cube CTL apply f by running this command Cube CTL apply f by running this command Cube CTL apply f deployment. yo so let's do deployment. yo so let's do deployment. yo so let's do that I that I that I will go to my repo again will go to my repo again will go to my repo again because and then k. postgress here we go because and then k. postgress here we go because and then k. postgress here we go I'm in my repo here we have the I'm in my repo here we have the I'm in my repo here we have the deployment. yo so I'm going to say Cube deployment. yo so I'm going to say Cube deployment. yo so I'm going to say Cube CDL apply deployment. CDL apply deployment. CDL apply deployment. yo this means that now when we look in yo this means that now when we look in yo this means that now when we look in our um namespace here we see three pods our um namespace here we see three pods our um namespace here we see three pods with database and we have an httpd front with database and we have an httpd front with database and we have an httpd front end right so this is our deployment and end right so this is our deployment and end right so this is our deployment and this is this is this is our database cluster that's running we our database cluster that's running we our database cluster that's running we have three pods with dat with a database have three pods with dat with a database have three pods with dat with a database running in them so that is the current running in them so that is the current running in them so that is the current state and now yeah I actually included state and now yeah I actually included state and now yeah I actually included this um example here in the read me but this um example here in the read me but this um example here in the read me but that's is exactly what we saw just now that's is exactly what we saw just now that's is exactly what we saw just now and now we're ready to apply our scaled and now we're ready to apply our scaled and now we're ready to apply our scaled object so let's take a look what that object so let's take a look what that object so let's take a look what that looks like so I'm going to open kada yl looks like so I'm going to open kada yl looks like so I'm going to open kada yl and this is the scaled object so this is and this is the scaled object so this is and this is the scaled object so this is the the object that kada uses to the the object that kada uses to the the object that kada uses to determine what what it needs to scale determine what what it needs to scale determine what what it needs to scale and how it should scale it so this is a and how it should scale it so this is a and how it should scale it so this is a very simple one that I
-
very simple one that I very simple one that I configured this you with the scale configured this you with the scale configured this you with the scale Target ref you you tell it what it needs Target ref you you tell it what it needs Target ref you you tell it what it needs to Target so the name for me to Target so the name for me to Target so the name for me is httpd front end and that's because is httpd front end and that's because is httpd front end and that's because the default Target is a deployment I the default Target is a deployment I the default Target is a deployment I will get back to that later but if you will get back to that later but if you will get back to that later but if you look in the documentation you can see look in the documentation you can see look in the documentation you can see the default values for that so now you the default values for that so now you the default values for that so now you only need the name of the deployment the only need the name of the deployment the only need the name of the deployment the polling interval is how often kada is polling interval is how often kada is polling interval is how often kada is going to fire off our our postgress going to fire off our our postgress going to fire off our our postgress query the coold down period is how long query the coold down period is how long query the coold down period is how long it should wait with scaling down I it should wait with scaling down I it should wait with scaling down I believe the Min replica count is the believe the Min replica count is the believe the Min replica count is the minimum of rep replicas that always minimum of rep replicas that always minimum of rep replicas that always needs to be running in our case it's needs to be running in our case it's needs to be running in our case it's going to be one because I always want to going to be one because I always want to going to be one because I always want to have one worker running and the max have one worker running and the max have one worker running and the max replic account is the maximum it can replic account is the maximum it can replic account is the maximum it can take now the trigger is of type post SQL take now the trigger is of type post SQL take now the trigger is of type post SQL and here we have configured the username and here we have configured the username and here we have configured the username and password for the and password for the and password for the database this is how the database can be database this is how the database can be database this is how the database can be reached so we are using a service in the reached so we are using a service in the reached so we are using a service in the cluster to reach our database so if I go cluster to reach our database so if I go cluster to reach our database so if I go to SVC here here we see all the services to SVC here here we see all the services to SVC here here we see all the services in this Kap Po namespace and one of them in this Kap Po namespace and one of them in this Kap Po namespace and one of them is Kap po database is Kap po database is Kap po database RW and that this is Kap po database R RW RW and that this is Kap po database R RW RW and that this is Kap po database R RW and this is the namespace name and we're and this is the namespace name and we're and this is the namespace name and we're saying this is a service on our local saying this is a service on our local saying this is a service on our local cluster that's how the kubernetes DNS cluster that's how the kubernetes DNS cluster that's how the kubernetes DNS works we are going to do the we're going
-
works we are going to do the we're going works we are going to do the we're going to use the postgress port the database to use the postgress port the database to use the postgress port the database name is app and this is the query that name is app and this is the query that name is app and this is the query that we're going to be uh basing our SC we're going to be uh basing our SC we're going to be uh basing our SC scaling scaling scaling on so then we can just kubernetes apply on so then we can just kubernetes apply on so then we can just kubernetes apply F F F kadao and now our scaled object is kadao and now our scaled object is kadao and now our scaled object is created so if I do K get created so if I do K get created so if I do K get Scaled Scaled Scaled objects we see that we have a scaled objects we see that we have a scaled objects we see that we have a scaled object and we also see that it has a object and we also see that it has a object and we also see that it has a status of ready and it's active so status of ready and it's active so status of ready and it's active so actually now we should see already some actually now we should see already some actually now we should see already some pods pods pods coming up in our cluster so I go back I coming up in our cluster so I go back I coming up in our cluster so I go back I go to my pods and here we go we see that go to my pods and here we go we see that go to my pods and here we go we see that we have four pods it's starting to scale we have four pods it's starting to scale we have four pods it's starting to scale out out out now look there's all these containers or now look there's all these containers or now look there's all these containers or all these pods are going to be um all these pods are going to be um all these pods are going to be um started up so why is it doing this well started up so why is it doing this well started up so why is it doing this well we configured kada that if our message we configured kada that if our message we configured kada that if our message cue has a length larger than one then we cue has a length larger than one then we cue has a length larger than one then we need to scale up and it's going to keep need to scale up and it's going to keep need to scale up and it's going to keep scaling up until it has reached the scaling up until it has reached the scaling up until it has reached the maximum number of replicas that we maximum number of replicas that we maximum number of replicas that we configured and this sort of simulates a configured and this sort of simulates a configured and this sort of simulates a situation that I described before where situation that I described before where situation that I described before where each worker is going to perform work on each worker is going to perform work on each worker is going to perform work on the que and then the que is going to be the que and then the que is going to be the que and then the que is going to be decreasing because we have more decreasing because we have more decreasing because we have more workers so now kada is just scaling up workers so now kada is just scaling up workers so now kada is just scaling up and scaling up and if I go to my
-
and scaling up and if I go to my and scaling up and if I go to my deployment I now see that it has 25 pods deployment I now see that it has 25 pods deployment I now see that it has 25 pods ready and now we have successfully ready and now we have successfully ready and now we have successfully scaled up our application with kada it's scaled up our application with kada it's scaled up our application with kada it's amazing it is so cool to see this in amazing it is so cool to see this in amazing it is so cool to see this in action and at work I've been trying this action and at work I've been trying this action and at work I've been trying this with hundreds of PODS and then actually with hundreds of PODS and then actually with hundreds of PODS and then actually that you and then you configure the node that you and then you configure the node that you and then you configure the node pool to also have autoscaling so it will pool to also have autoscaling so it will pool to also have autoscaling so it will actually create more notes and that actually create more notes and that actually create more notes and that takes a little bit of time but it's takes a little bit of time but it's takes a little bit of time but it's really cool to see that happening so now really cool to see that happening so now really cool to see that happening so now uh our pods are doing the work the uh our pods are doing the work the uh our pods are doing the work the message queue is decreasing this is the message queue is decreasing this is the message queue is decreasing this is the the pods are not actually influencing the pods are not actually influencing the pods are not actually influencing the message queue this is just a demo the message queue this is just a demo the message queue this is just a demo but now we're going to pretend that our but now we're going to pretend that our but now we're going to pretend that our message queue is now empty so for that message queue is now empty so for that message queue is now empty so for that we're going to delete all the messages we're going to delete all the messages we're going to delete all the messages with this command delete from Q with this command delete from Q with this command delete from Q messages and now 100 are deleted and if messages and now 100 are deleted and if messages and now 100 are deleted and if I now do a select count we will see that I now do a select count we will see that I now do a select count we will see that the count is zero so now our our message the count is zero so now our our message the count is zero so now our our message cue is empty and this means because the cue is empty and this means because the cue is empty and this means because the number in our scaled object number in our scaled object number in our scaled object right if we go to our scaled object the right if we go to our scaled object the right if we go to our scaled object the target query value is one so if it's target query value is one so if it's target query value is one so if it's less than one then it should not scale less than one then it should not scale less than one then it should not scale anymore in fact it should go down to the anymore in fact it should go down to the anymore in fact it should go down to the Min replicas now I found that this takes Min replicas now I found that this takes Min replicas now I found that this takes a while it takes takes a few minutes to a while it takes takes a few minutes to a while it takes takes a few minutes to um scale down and if I go back to my um scale down and if I go back to my um scale down and if I go back to my pods now we will still see that there is
-
pods now we will still see that there is pods now we will still see that there is a lot of PODS um running so I'm going to a lot of PODS um running so I'm going to a lot of PODS um running so I'm going to give that a little bit of time and now give that a little bit of time and now give that a little bit of time and now it has gotten some time so let's check it has gotten some time so let's check it has gotten some time so let's check back on our cluster and here we go our back on our cluster and here we go our back on our cluster and here we go our application has scaled down we have only application has scaled down we have only application has scaled down we have only one worker running and it's exactly what one worker running and it's exactly what one worker running and it's exactly what what we wanted and just for fun let's what we wanted and just for fun let's what we wanted and just for fun let's just uh scale it up one more time so just uh scale it up one more time so just uh scale it up one more time so we're going to go back and then we're we're going to go back and then we're we're going to go back and then we're going to run this command again and then going to run this command again and then going to run this command again and then the queue is now 100 messages long again the queue is now 100 messages long again the queue is now 100 messages long again and then whoop here we go we see that and then whoop here we go we see that and then whoop here we go we see that the kada is scaling up again so this is the kada is scaling up again so this is the kada is scaling up again so this is really powerful and I hope this is a really powerful and I hope this is a really powerful and I hope this is a very quick way for you to get started to very quick way for you to get started to very quick way for you to get started to sort of wrap your mind around it and to sort of wrap your mind around it and to sort of wrap your mind around it and to get something physical going and um I get something physical going and um I get something physical going and um I was certainly missing this in my when I was certainly missing this in my when I was certainly missing this in my when I was learning kada myself recently was learning kada myself recently was learning kada myself recently hopefully this has been useful to you hopefully this has been useful to you hopefully this has been useful to you please let me know in the comments what please let me know in the comments what please let me know in the comments what you think and if you like my content you think and if you like my content you think and if you like my content please like And subscribe because it please like And subscribe because it please like And subscribe because it really motivates me to keep going all really motivates me to keep going all really motivates me to keep going all right I wish you a good day and see you right I wish you a good day and see you right I wish you a good day and see you in the next video
Summary
This tutorial demonstrates how to implement Kubernetes Event-driven Autoscaling (KEDA) on Azure Kubernetes Service (AKS) to scale applications. It references setting up a simple application with a database, highlighting that KEDA needs a trigger to initiate autoscaling. The practical takeaway is that setting up KEDA is easier than it sounds, especially with KEDA now being an official AKS add-on.