- Coming up, we take a look at recent
updates to the Azure Kubernetes service
for developers and ops.
From new auto-scaling options using
virtual nodes, how you can use Dev Spaces
to test your AKS apps without simulating dependencies,
and new ways to troubleshoot and monitor
your Kubernetes apps Azure Monitor.
(upbeat music)
So I'm joined today by Ria Bhatia
from the Kubernetes team in Azure, welcome!
- Thanks for having me,
it's great to be here.
- So, we've been following Kubernetes since
the early days when Brendan Burns joined Microsoft,
and we've seen how it modernizes apps scaling
and servicing using containers on demand
and without downtime.
And now with identity and access management
integration via Azure AD, AKS is a great
option for those enterprise apps.
What's the team been working on with the latest
round of AKS updates?
- So we've made a couple of core architectural
enhancements, to improve both the developer
and operational experiences within AKS.
Starting with the ops side, before now
if you had any unpredictable workloads,
and you needed more capacity,
you would have to wait for a node
to spin up before you could start
provisioning pods.
Now we have virtual nodes as an add on in AKS.
It's serverless and has elastic capacity
that is backed by Azure container instances.
Which makes it easier for you to scale up
your deployments within AKS,
without having to wait for compute first.
Next, on the developer side.
On a shared cluster with multi-tiered apps
we've made it easier for you to spin up dev and test
environments within Azure Dev Spaces.
When you create an Azure Dev Space, these are dedicated
to a single developer, which are separate from production,
but it can talk to production services
and other dependencies so you don't have to build
a fully parallel test environment.
- Okay great, so it sounds like both of these updates
are really gonna help streamline the end-to-end
experience if you use AKS,
but can I use my existing CICD workflows and my dev tools?
- Yeah, so these updates were built so you can continue
to use your tools and processes that you're used to.
For example, within Azure Dev Spaces you can use VS Code,
or Visual Studio, and it can work with your current
CICD processes.
And using virtual nodes is equally easy because it's a
one-switch enable as part of the AKS cluster creation flow.
- Right, so it's gonna be easy to take advantage of
these updates, but can you show us an example of
how you'd use virtual nodes in Dev Spaces?
- Yeah, so first I'm gonna show you how to create a cluster
in AKS, and then we'll go into Dev Spaces.
So, first we're going to create a cluster in the
Azure portal.
So I have my subscription in here, I have a resource group
that I've already created,
and then I'm gonna pick a cluster name.
I'm gonna call it Mechanics,
and then I'm gonna use that same name for this DNS prefix.
I've chosen the region to be East US
and that works out for me.
And then down here I have this special part,
this Scale part, and you can choose the amount of nodes
that you want to have in your cluster.
I'm gonna choose one because that's all my study state needs
for the workloads that I have running all the time.
But then I'm also gonna use this new feature Virtual Nodes
down here to enable that elastic capacity that's backed by
Azure Container Instances.
Then I'm gonna fast forward to the networking portion,
where we've gone ahead and defaulted everything for you,
so you don't have to go in at all and pick your own subnets,
you can just use ours, or you can bring your own VNet
and then pick your own subnets if you so choose.
And then you can just go ahead and review and create.
- Cool, so presumably you could use this to connect
to an existing cluster that's talking to Azure AD
or Azure services?
- Yeah, that's right, it can be part of your Azure Vnet
and so now I'm gonna connect to my cluster in the
Azure Cloud Shell.
So, navigating to Cloud Shell in the portal,
I'm going to use the 'az aks get-credentials' command
to go ahead and connect to the cluster that I've created.
So, I'm gonna click enter, and from here my kube config
is gonna be merged to my local environment
so now I can connect to my cluster whenever I want.
Let me show you this working.
When I go ahead and get nodes,
and we're gonna see that one node that I created
plus that virtual node in here.
So that's right here, I have that one node,
and then that virtual node, virtual node aci-linux,
and now we can go ahead and actually spin out a pod
to this cluster and schedule it to that virtual node.
And this is gonna go ahead and schedule out this deployment
to that virtual node itself, and it's actually gonna
spin out into Azure Container Instances
rather than within the cluster.
- And in this case it looks like you're deploying
an Nginx web server via Yaml, straight to the
new virtual node.
- Yeah, exactly, that's exactly what I'm doing.
So, if I go ahead and get pods and I do '-owide'
...so this will bring out the output and make it wide
I can see that this pod was actually scheduled out
to that virtual node.
We're not gonna wait for this to spin up, but this
is how you would deploy to your new cluster.
- Okay cool, so one of the strengths of Kubernetes
is scaling dynamically on demand.
How's that gonna work with our new virtual node?
- So, let me simulate an actual use case for you.
So I'm gonna open up my browser, I'm gonna navigate to this
Tailwind Traders app.
So basically it's a hardware store where you can go in
and buy home appliances, you can buy some gardening tools,
for me personally, I need the gardening tools because
my plants are dying in my apartment.
But let's say you wanted to prepare
for some unpredictable traffic.
So in here, I've gone ahead and already started a bunch
of load behind this application.
So it's simulating a bunch of requests or customers going
into this app and trying to check out.
I'm also using the Horizontal Pod Autoscaler in Kubernetes
and then also Prometheus in Grafana to be able to gather
metrics and then scale on those metrics.
So within our Grafana dashboard, you can see the amount
of requests per second that are being sent
over here on the left.
On the right over here you can see that we have the
requests per pod, so that means whenever we get to about
100 requests per pod, our HPA,
or Horizontal Pod Autoscaler is gonna go ahead and
spin up another pod for infrastructure.
So we're dynamically scaling based on our customer requests.
Down here, you can see the latency, or the response times,
so it's the amount of time it takes for our application
to actually respond to these customers and enable them
to check out.
You can see that when our pod started to spin up,
our requests or our latency went down, which is great.
And then also, we have about 19 pods in
Azure Container Instances and then about two pods in the
actual cluster at a steady state, always running.
- Okay and in the event that traffic slows down
it's gonna scale down.
- Yeah, exactly.
It's gonna scale down all by itself,
you don't have to do anything extra.
- Okay great, so you've spin up a Kubernetes cluster
with virtual nodes and got an app running
in just a few minutes that essentially scales infinitely.
- Exactly, so it's pretty easy getting the cluster set up
with virtual nodes enabled, it was also relatively easy to
get the set up for this infinite scale using a small
amount of code with our Horizontal Pod autoscaler.
- Right so no more planning for capacity management,
you just focus on your code and your application.
Now you mention the other architectural change
was Dev Spaces.
- Yeah, for creating an application you can use Dev Spaces
with your current CIDC processes.
You can also check in code and content and fixes after
you make them as part of your Dev Ops workflow.
- Okay cool, can we take a look?
- Yeah, I have this bikes application running
where you can go ahead and rent out a bike.
Let me go in and show you guys this Devs Space
that I'm using.
I'm in this default Devs Space called Dev,
I'm gonna go ahead and copy this URL and
put it into my browser and show you the bikes application.
So within this application, you can go ahead and rent out
a bike for a certain amount of time, and you'll be
charged for that certain amount of time.
This is the application that we're all working on as a team.
I'm gonna go ahead and rent it, so there I go.
And then I'm gonna go ahead and change my Dev Space.
This is kind of simulating a bunch of different developers
working on the same services.
If I change my Dev Space I'm actually gonna get a copy
of this bike service application, which is pretty awesome
because any edits I make to that space, basically,
or that service, are gonna be my own and my own only,
it won't affect anyone else.
In here I've gone ahead and already switched to the
Stephen Dev Space.
And now I'm gonna get a list of resources and services
that I'm using within this space.
Cool, so it's come up, and basically you can see that
Stephen has its own bike application and its own
bike service so I can work within this.
I'm also gonna use the AZ Dev Spaces command line
to go ahead and list off the URLs that are associated
with the Stephen Dev Space and then I can hit my own
end point in my own service.
And then I have it, I'm gonna go and copy it in
and then put it into my browser.
So this is now the Stephens Dev Space end point.
I'm gonna do the same thing and try and check out
the same bike, but you'll see here that I'm not actually
able to rent it out and there's no error message
so this is actually a bug in my code that I need to use
VSCode to fix.
I'm gonna jump into Visual Studio Code now,
and I'm gonna use the web development workload and tools
for Kubernetes installed within VSCode to debug it.
I can see here that since I couldn't rent it,
I'm gonna attach a break point to the right spot
to figure out what the variables are passing are and
what my methods are passing, kind of figure out
what's going on here.
So I've put in that break point, I've attached the debugger
to my cluster in the service and I'm gonna go ahead and
press play and everything's kind of gonna build on its own.
Cool.
So now I'm trying to rent the bike so I can activate
that debugger, I'm gonna try and rent it and now we've seen
that we've hit the break point.
So now I'm gonna go into Visual Studio,
I'm going to enlarge in the variables over here
and now I can see that the bike variable for whether
it's rented or not is false, that means it was rented
but it's still showing up in my UI.
So basically I just need to add a fix to be able to
filter through all the bikes that were rented and
enable that.
Once I'm done I can go ahead and attach that debugger
and everything will run again and then the new version
of my service will be created.
So everything, all the new requests can be re-routed
to that service.
- Awesome, so you've created a Dev Space that you can
iterate on in a pre-commit area, but without the overhead
of recreating the entire site just for testing,
validation or debugging.
Now can you mainline your changes into production then
if you do correct issues or do you need to duplicate
your changes into a production version?
- Using CICD once you fix something in your app's
content or code, you can commit and push back into your
git-repo source control and then everything will just work.
- Awesome and this will save a ton of time.
Now, you just showed how you'd manually debug and
make changes to code and how fast it is to get clusters
and Dev Spaces running but how would you get alerted
if something wasn't healthy within your app?
- That's a great question.
So if your Azure Container Instance starts crashing,
you can use Azure portal and Azure Monitor
to figure out what's going on.
So in here I'm in Azure Monitor, I'm in the insights part
and I'm looking at my containers and I can see all the
different containers running in my cluster and then
all the different containers in ACI too.
In here I can go into logs and metrics and things like that
but if you also wanna look at the overall health
of your cluster, you can navigate to this cluster tab
and then you can see the CPU utilization, you can see the
memory utilization, the node count, and then you're able
to figure out deeper-rooted issues of your actual VMs
in your cluster and the actual health of your cluster.
- And it's relatively easy to enable as well?
- Yeah, you can just use Azure Monitor's workspace
to get this running.
- Awesome Ria, thanks for showing us all the latest updates
to AKS and the things you can do to really drive quality
and drive insights from your code and operations.
Now, if you're new to Kubernetes, where do you suggest
the folks watching get started?
- If you're just getting started with Kubernetes or if
you're already using Kubernetes then check out the links
shown to start using virtual nodes and Dev Spaces.
- And of course, we'll continue following the updates to
Kubernetes and AKS on Microsoft Mechanics.
And if you haven't already, hit the subscribe button
to keep up to date with the latest tech at Microsoft.
Thanks for watching!