Hey, friends, did you know that you can
simplify your Kubernetes development process with automated deployments
for access powered by draft? Draft takes care of the tedious work of containerization
so you can focus on developing your app. Steve Buchanan is here to show me
how it works - today on Azure Friday. Hey, friends. I'm Scott Hanselman,
and it's Azure Friday. I'm here with Steve Buchanan.
How's it going, sir? Good. Thanks for having me on. So, listen, I have been containerizing all the things,
but I have yet to throw it into AKS. It's just a little, little scary. I've got the apps. The apps are working, but
it just seems like a lot of moving parts. And I understand that
there might be a solution for me. Yeah, so it can be a lot and intimidating
to go from just code to how do I get this app running on X? And that's what we're going to talk about
today is, is something called automated deployments for across. But it has been revamped and now it's
powered by something called draft. Okay draft. And you know, everything with Kubernetes
has to do with, you know, being in a boat
and ships and stuff. So there's like a helm and charts
and the draft of a ship. I assume they always pick a noun for that reason. Yeah, I'm not sure of the history
behind the name, but I do know that draft was created
by the same folks that created Helm. All right. Very cool. Yeah. The draft of a ship's hull is the distance between the waterline
and the bottom of the hull. So presumably draft is going to get me
closer to the boat or closer to the ship, which I'm
looking forward to seeing from you. Yeah, definitely. It'll get you closer
to deploying your apps on X, Right. So let me take you in
and show you the workflow of what this looks like
and then we'll dive into a demo. So here we have you would actually start with your code
in a GitHub repository, right? And then you would point draft or automated deployments
in this case, add that repo. And then the second step is automated
deployments is going to generate Docker file for you. And so it's going to detect your language. So if you if you wrote your app in Python or let's say JavaScript or go or rust, it's going to detect that and then it'll
generate that Docker file for you. And then you can go to the next step where it will actually generate
your Kubernetes manifest files for you. So that's your deployment file
and your service file. So the service file is,
is how you would access your application. And the deployment file contains
like the pods and whatnot in it, Right? The other thing that draft does
and kind of move into the next step is it generates a connection between an Azure. So your resources
like your Azure Container Registry and your resource group and your access
and GitHub and it's going to create a GitHub action workflow for you
that's going to do the heavy lifting. And so it's creating that connection
between Azure and GitHub. And then it's also going
to set the permissions that are needed and it'll create that GitHub
action workflow. And then you will need
to approve a pull request. And once you do that,
it kicks off the workflow and creates the Docker
file, pushes it up to the registry and then deploys the Kubernetes
manifest files to your AKS cluster. So it's a pretty smooth process
and you don't have to have a ton of knowledge around like Kubernetes
and how to do all those steps. Should we dive in now
and take a look at this in action? Yeah, I definitely want to understand this because it seems like it's
generating a lot of the toil, right? Just a little administrative trivia
that's involved, whether it be the Docker file,
which I may or may not already have, but definitely the Kubernetes manifest
files and then having a convenient action workflow is just one more thing
that's automated. And once it's done,
I don't have to think about it again. Yeah, definitely. And two things I want to call out. So let's say if you do have a Docker file,
you can use this tool with the app as well. And if you want to use home charts
instead of Kubernetes manifest files, you can do that too. All right, let's see it. Awesome. So let's go to my GitHub repo first. So I have a very simple
just JavaScript application. Not much to it, right? That's what we're going to point to. And here is my X cluster. And if I scroll down, you'll see something
called automated deployments. This is an public preview. And then in here,
this is where you'll actually create what's called the workflow. So you click on the create button
and you have two options. So if you click on this, deploy
an application. That's if you had an app with a Docker file already,
we don't have that in this demo. So we're going to click
on the containerized end deploy and this is where it creates
the Docker file and the Kubernetes manifest files for you. So give it a name there and then I'm already authorized
with my GitHub account. And so it's looking at my repositories. And then if I go in here and I select my Java app, my JavaScript app, which is just a little rest API,
and then I can choose my branch. And then here you'll notice it
automatically detected my language. And if I were to click this,
you'll see that I have access to like Java, P, Python rust, etc. Now it will automatically detect
that for you, let's say, if it got it wrong for some reason. And you know the the language that it needs to be,
you could change that here. Right. And I'm going to change the port
because I know my my rest API runs on 3000. And then here's where it generates
the Docker file for you. And so you can actually preview the file
and see what it's going to create
when it creates the Docker file, right? And then a ignore file. And then here's where you select
or create a new container registry. So it's really simplifying this process
for you. Now, I already
have a container registry, so I don't need to create one there and then I'm going to give my image a name and then we go to our deployment section and then here we want to create a namespace because
I want to plug this into a new namespace. So I'll do that here. And so this workflow
is going to create that for me. In my X cluster,
you could see my deployment file here and you could actually scroll through that
and see what it's doing. And here's my ACR,
here's my image, my port number, and then also your service file, right? Which is going to create your Azure Load
balancer for you. So then you click next and you can review the information
and then you click deploy. So here what it's doing is it's creating any resources
that need to be created in Azure. It's setting up permissions. It's making the connection
between Azure and GitHub. So it's actually creating the secrets
over your GitHub repository and it's basically
getting everything ready. And so it's doing a bunch of work. And when this update's here
and it's pretty fast, then it's going to ask me
to approve the poll request, right? So here you don't have to do anything except for come in here and approve this. My sure that it's doing the right thing at every entry level. Yes. Well you can come in and double check it. Right. So you could actually come in here
and you could check like your action secrets
to make sure it created the right stuff. You could do the same thing in Azure. You could go into your code repository and you'll notice
it created a manifest folder, your Docker
file, and I actually show you all of that. But I want to point out here
under our GitHub actions that here's our workflow running, right? So what it's doing right here is it's building the image, it's
pushing it up to the registry, right? If I go back here to Azure,
I can actually click close here and you'll see a status in here as well. So you can watch it over here
or you can watch it over here in your in your GitHub repository now that we're seeing it live too. I just think that's so cool. Like, I know it's obvious, but like just going into GitHub actions
and like this is not a video. This is live, right? And it's being pushed to that ACR
that you just made. And if it fails, right,
you can see the error. You can go
make the correction and rerun it. Let's say
you got a port number wrong in your in your Docker file or something
like if it didn't match up with what you had in your code,
you could come in here and see that and then you could go fix it
and then rerun the workflow. So to answer your question
directly, Scott, I could go over here to code
and in my repository now I have this GitHub workflows folder
which has my GitHub action in it. I have this manifest folder which has
my Kubernetes deployment files in it. Now my Docker file,
like everything that I need. Hmm. Is is there now. Right? And so everything is to taste right. Like now that they're made,
you can tweak them, but the actions are already there.
So they're actually going to keep running. So you do have an automated deployment
right here that isn't static. It can be modified and changed
and improved upon. Absolutely. And in fact, that's a really good point,
because if you make changes to the code now, all of your CIC
essentially is set up here and it's going to fire this off again
and deploy those changes to your Kubernetes cluster. Right. So and so now I'm back in the portal,
and if I click refresh, you'll see that this succeeded. So now we can check out our cluster
and see if this actually worked. And like you said, we're doing this live. So fingers crossed, right? So there's the namespace that it created. And if I go to work workloads, here is my deployment and it has my part in it,
which I only have one in this scenario. And then if I go to services
and I scroll down, here's my actual service and my Azure load balancer,
and then if I click on this IP, here is the app,
let me make this a little bit bigger and this is just a rest
API of of jokes, right? So I'm big into dad jokes, so I need to do me a little bit more for me or all the way nice. So yeah, so we needed a Kubernetes powered joke API for dead jokes and that's live on the Internet right now. And you did that in 10 minutes. Yeah, like super easy, super, super quick. So the goal here is to simplify
the developer experience for archaea so developers can come out
and get started with access really quick. That's great. So we're going to go and learn
more about this and like start today so you can go out to the Microsoft, learn documentation and just look up automated deployments for access. Okay, Automated deployments for Azure
Kubernetes service in preview being worked on actively,
you can check out the code up at GitHub dot com slash Azure slash
draft and learn more about that. So all the stuff that you did
in the Azure portal, you could also do potentially at the command line
if it makes you happy as well. Yeah, definitely
there's command line version and then there also is an extension for voice code. So you could use the gooey and voice
code to do what we just did here. Very cool. Well, thanks so much
for hanging out with us today. Thanks, Scott. I am learning all about draft version two
and how to contain, erase my apps and deploy them
to access today on Azure Friday.