Microsoft resurrects Deis Labsโ Kubernetes quick-start tool to help you package existing code for Azure Kubernetes Service.
Cloud-native development isnโt as easy as it could be. Platforms such as Kubernetes simplify the process of running a scalable set of services, but you still need to create the application youโre running in the cloud. Itโs not a matter of putting your code in a container and writing some configuration YAML; you need much more to have a build that can be deployed anywhere, anytime.
Five years ago, Microsoft acquired the Deis Labs teamย with the intent of letting them continue to build open source Kubernetes tools. Itโs been one of the more successful acquisitions. The team has delivered major upgrades to the Helm Kubernetes packaging tools and the Brigade event-driven workflow system, as well as pioneering WebAssembly in Kubernetes with Krustlets and using Linux device drivers to expose edge hardware to Kubernetes in Akri.
The first post-acquisition release was Draft, a set of command-line tools intended to help you quickly build prototype containerized applications, delivering the scaffolding to develop code on your own PC before pushing it to a Kubernetes instance. It was an interesting experiment but sadly didnโt get the community uptake necessary to take it much further than the initial release. If you go to the list of Deis projects, itโs marked as archived, with no work planned. Even so, it clearly left its mark on those who used it, with Deis regularly asked if theyโd take Draft further.
Draft is back
Microsoft certainly noticed the continuing interest in Draft as a tool, as Build 2022 saw the Azure team launch an updated version, Draft 2, for use with Azureโs own managed Azure Kubernetes Service (AKS).
Like the original, Draft 2 is a command-line tool to quickly build a Kubernetes application. Unlike the original, itโs intended to take existing code and package it for use in AKS, building the container and manifest files to run your application in Kubernetes along with the scripts and workflows needed to deploy it from GitHub to AKS.
There are a lot of similarities between the two versions of Draft, but the biggest change is the shift from a local development tool to one based around the Azure CLI and working directly with the cloud. Itโs a model that fits with how Microsoft has been evolving its AKS environment, offering it for on-premises systems via Azure Stack HCI or using Azure Arc on your own servers. With Visual Studio Code offering remote development tools for Azure, including the Azure CLI, and with GitHub Codespaces being a way to deliver a complete cloud-native developer experience to your desktop, the world has changed significantly since the original Draft was released.
The Draft 2 tool is focused on Azure, GitHub, and AKS, but it remains an open source project so thereโs the option of creating your own fork for your chosen Kubernetes environment, whether itโs self-hosted or running on AWS or GCP. Like most Kubernetes tools, itโs written in Go, with workflows in YAML. To build your own Draft 2 install, clone its GitHub repository. With Go 1.118 or better installed, use the familiar make to build the Draft binary before adding it to your system path.
Using Draft 2 with Azure
The initial Draft 2 release is part of the aks-preview extension to the Azure CLI. You can run the Azure CLI locally or in Azure as part of the Cloud Shell development and management environment. This means it runs on top of Microsoftโs internal Debian-based BL-Delridge, which hosts Azureโs Cloud Shell. This should ensure that Draft 2 will run on any Debian-derived Linux with minimal work, as the only difference between CBL-Delridge and Debian is that Microsoft compiles all the packages itself for security reasons.
There arenโt many prerequisites for using Draft 2. All you need is Azure CLI, an AKS cluster, and an Azure Container Registry instance. Once youโve installed the aks-preview extension, it gives you the tools you need and somewhere to store and run your application containers. Installing the extension is simple enough by using the following command: az extension add โname aks-preview. Use az extension update โname aks-preview to make sure you have the latest version.
With Azure CLI configured to use Draft 2, you can take an existing application and turn it into a Kubernetes application. From your application directory, call the Azure CLI and Draft: az aks draft create. If you prefer, you can use Draftโs destination flag to target a specific directory. This generates the files needed to build your application, including the necessary Dockerfile.
Automating Draft with GitHub Actions
Where Draft 2 differs from the original version is its integration with key parts of the Azure and GitHub deployment workflow. Youโre now able to quickly build a GitHub Action that automates the process of pushing code artifacts from GitHub to AKS. Draft now has a draft setup-gh command that registers with your GitHub account using OpenID Connect and links it to your Azure Container Registry. Once that link is in place, youโre ready to build your deployment workflow, starting from your local clone of your application. Use the az aks draft generate-workflow to build the action.
Once an action has been built, youโll need git to push it back to your application repository in GitHub, ready for use via the Actions tools. You can then edit code locally using tools like Visual Studio Code, saving back to an appropriate branch using the VS Code GitHub extension via pull requests. If youโve automated your action, a pull request will trigger a build and deliver your application to AKS, ready for testing.
Microsoft has provided a shortcut to use Draft with a fresh application in a new cloned repository. By using the draft up command, you will authorize access and build an action in a single line. If you need to modify an action, use generate-workflow again. Finally, you can use the draft update command to enable AKS web application routing. A Nginx-based ingress controller adds internet access to your application and supports the Open Service Mesh tools in AKS to help secure your code.
Itโs good to see Microsoft bringing Draft back. Tools such as this are an essential step for any cloud-native migration, taking code and automating the process of building the scripts and manifests needed to run it on Kubernetes. Itโs also interesting to see another Azure tool taking a dependency on a GitHub feature, an approach thatโs likely to become more prevalent in future as the two organizations increasingly work together on projects.
Also by Simon Bisson:


