>> [MUSIC]
What's up, everybody?
Hello. We've got a lot on the agenda today,
going over AKS today or Azure's Kubernetes Service.
What we need to do first and foremost
is we need to refactor our environments.
Basically, what we need to do is we need to get rid of anything
that we don't need and keep what we do need.
We need to go into our Terraform
and we actually need to essentially go to feature.
No one's called a feature.
Whatever, because it's not a feature thing.
But we'll just do that and it's going to go off the main branch
and I'm going to hit "Create branch" Terraform here
and we do git check out main or batch git branch -a, git branch -D.
Cool, and then we do git checkout branch-b
feature slash refactor resources.
As a matter of fact, what I'm going to do for now is that
I'm actually going to get rid of
just all of the stuff we don't need.
We're just going to start essentially from the ground up.
Let's take a look at our device here.
We got rid of that.
We don't need anything related to container instances anymore.
We got rid of the main
for the cache name in the container instance as well.
We got rid of the network profile for the container instance,
we got rid of the Redis private DNS zone and its network link,
as well as the private endpoint for Redis too.
We got rid of the actual cache
and since we're not going to be paying for that anymore,
we got rid of the resource groups for caching container.
Service principles has gone bye-bye
and the subnet as well is also removed.
I'm going to go here,
I'm going to click on this
and I'm just going to let myself go here,
look, you're here and we're going to
create a pull request with that task.
Work items refactor environments.
See how far this has gone.
We both good on this?
Yeah. We are not?
You go back here.
What's going to happen?
It's going to destroy the private endpoint
and it's going to update the subnet
accordingly to the new dressing, which we want.
This is public IP spot node pool.
This is really what we want right here.
If you guys have ever used Amazon
before you probably know about spot instances.
They save you a lot of money.
Basically, you can do the same thing with Azure,
which is pretty awesome.
Expand this really quickly.
Take a look.
Private endpoint gets destroyed,
and so does the subnet for it too.
Let's go ahead and approve.
Refresh.
I make sure cool and complete
and then we will complete this work item right here.
Now again, I'm going to go back to Terraform Cloud.
We're going to grab this one actually for now.
We're just going to use the one right here for now
so that I can look at both of them.
But look at that.
You destroyed.
Perfect.
The subnet, then all the all of that applied.
Now what I'm going to do is I'm going to go to here in prod
and I'm going to actually run the same thing here.
Except so we're going to run this one.
We're going to discard and we're going to run that.
Cool.
It's going to destroy 15 and change one,
and we go, and let that run as well.
Let's go ahead and do git check out.
Just go and delete that branch really quickly.
That might create a new branch.
This one is going to be provisioning the AKS cluster.
I'm going to click "Create branch," then say feature AKS cluster.
Then I copy that really quickly,
so I don't have to type it later.
There we go.
We'll go back here and delete that,
and I'm going to paste that in its place and there we go.
Now, if I go here,
let's look at what we got,
we've got our virtual network.
That's good.
Our twin gate access token to refresh tokens,
we're still going to need those,
but we're not going to worry about them right now.
The subnet, that's going to be something we need.
Let's go ahead and take a look at the Kubernetes examples,
and we should see nodes on the internal network.
See that the internal pool sits on that.
We need to make sure that that is also the case.
We're going to just basically copy this
and this will be our second subnet now.
Now we only have two subnet chats.
Let's go network topology.
We can get rid of this, we can get rid of this.
All of this can go away.
This can go away.
Even this can go away.
Key vault can go away.
We're going to copy and paste
and we're going to create a new network
and this is going to be Kubernetes.
This is going to be our quirk dev Kubernetes,
and we're going to go in here and we're going to say Kubernetes.
We're going to need service.
What will happen now is these
will just go directly out over this subnet
and access the database like so.
A lot more straightforward in the sense of the networking.
We literally have two subnets database and Kubernetes,
and they just talk to each other one over the other.
This is all fine.
This is good.
I just need to create a new one for the Kubers.
We're going to do that.
It's not in both those
and then do Kubernetes, look at that.
Thank you.
Now we've got our resource group and our subnet for Kubernetes.
Let me just go over here.
Cool. Kubernetes.
I'm going to just go ahead and add this stuff.
Database name is good.
Kubernetes is good.
Subnet address, this is good.
That's good.
Kubernetes name virtual network itself, Kubernetes.
Cool.
Now I'm going to do feature Kubernetes.
This is going to add the resource group in the networking.
Let's just make sure that this run.
Hey, look at that chat and everything got deleted properly.
Now if I go into Azure and refresh,
we should see a lot of those resources disappear.
Yeah, look at that.
Remember how I just had like container instances
and all that stuff here, all that's gone.
If we go to container instances should be gone.
Completely gone.
Cool. We have officially cleaned and refactored the environment.
We added this and we added this.
Yeah, all this looks good.
We got the nodes on the internal network,
we've got the private API server
so that we know it's only accessible internally.
We made sure we've got our network policy with Calico.
I think those are the basics of what we need.
I'm going to add the Kubernetes cluster
and I'm going to add the outputs push
and let's see if it works in Terraform.
Let's take a look here.
Kubernetes cluster since the value row config, config row.
Let's you ask the SKU tier free.
That's good. I like that.
I like seeing free. No HCI.
None of that.
Auto scaler, not worrying about any of that right now.
Network profile standard calico load balancer.
This looks good.
Then we'll get the client secrets
and the kube_config afterwards.
I think that looks good.
Let's go back here.
Look at this run really quickly.
This makes sure that it's all good.
Again, I'm going to actually move out of this now.
We close this.
Kubernetes looks good.
Cool. Awesome.
We should have a new plan here and execute it.
There we go.
Fix its resource group, confirm and apply.
Well, let's see if this gives us our Kubernetes cluster.
We should see the subnet actually get created pretty quickly.
We go here and the subnet,
there it is. It's already been created.
We got this chat. We got this.
Come on, we can do it.
I think it's actually provisioning now.
Normally it like kicks back.
There it is. Yes.
Well, we're good.
Sorry, I just got really excited.
Cool. There it is.
Though here's our Kubernetes cluster.
If I click on it, you're actually going to see that
it says creating still.
But you can see here we've got like a Kubernetes encryption type.
We don't have any node pools yet
or we're not doing any virtual node pool HCI.
That's been disabled.
You can see we've got one node for running 1-7 on the standard B2s.
We've got Kubernetes version itself, which is on the same.
We don't have our back enabled right now or AKS
active directory Azure CNI,
Pod CIDR, Service CIDR,
DNS IP, Docker CIDR, Calico load balancer.
All of this looks good.
Cool.
We have a Kubernetes cluster.
If you want to create a Kubernetes cluster like I did,
all you have to do is,
first and foremost, create yourself a resource group boom.
Right here we can see our new research group,
our new Kubernetes resource group.
After we created our resource group,
we then created our subnet.
Now again, I have some nice little magic sauce around
how I dynamically generate my subnets address prefixes.
But at the end of the day, it's basically a CIDR for that network
or for that subnet sorry.
Here's our subnet.
Then after we created our subnet,
we went ahead and created our Kubernetes cluster,
and so we gave it the name.
We gave it the resource group information.
We gave it the DNS prefix.
Made sure that it was private as a $100 cluster.
It's running the burst you.
We made sure that we set up the network profile to be Azure.
A load balancer is the standard SKU
because it did seem to make more sense
for the options that we got out of it.
We also got Calico as our networking policy.
Once we did that, we ran Terraform.
You could see here it is right here.
Here's our outputs now. I'm not going to click that
because if I click that, you'll see it.
But you'll see here that my apply has successfully
finished the first time chat.
That's pretty dope.
Now I have a Kubernetes cluster fully running in Azure.
There you go.
That is it.
First try to chat.
Pretty dope.
[MUSIC]