December 16, 2017

Microsoft’s Deis has released Draft to makes it easy for developers to build applications that run on Kubernetes. Draft does this by providing tools and simplifying steps required to build for Kubernetes. If your enterprise has looked at containerization, Docker or Kubernetes before, this latest tool might very well nudge you to take the dive!

What is Draft? How Does It Fit into Kubernetes?

As its github account indicates, Draft targets the “inner loop” of a typical developer workflow: during the app-building and code-hacking, but before code is committed to a version control repository. At this time, applications written in six languages—Python (Newstar’s favorite language), Java, Go, Node.js, Ruby, PHP—are supported.

Using Draft

Using Draft is a simple three-step process fitting right into that developer “inner loop” we spoke before:

  1. draft create to containerize your application based on Draft packs
  2. draft up to deploy your application to a Kubernetes dev sandbox, accessible via a public URL
  3. Use a local editor to modify the application, with changes deployed to Kubernetes in seconds

Running the draft create command will result in Draft creating a dockerfile and and Kubernetes Helm chart for that app.

Here is how it would look for an example Python app which uses Flask for an “Hello World” server:


$ draft create
--> Python app detected
--> Ready to sail
$ ls
Dockerfile app.py chart/ draft.toml requirements.txt

The draft.toml file contains basic configuration information about the application. See the Draft User Guide for further information and available configuration options on draft.toml.

Next would be invoking draft up to deploy the app to a Kubernetes cluster.


$ draft up
--> Building Dockerfile
Step 1 : FROM python:onbuild
onbuild: Pulling from library/python
...
Successfully built 38f35b50162c
--> Pushing docker.io/microsoft/tufted-lamb:5a3c633ae76c9bdb81b55f5d4a783398bf00658e
The push refers to a repository [docker.io/microsoft/tufted-lamb]
...
5a3c633ae76c9bdb81b55f5d4a783398bf00658e: digest: sha256:9d9e9fdb8ee3139dd77a110fa2d2b87573c3ff5ec9c045db6009009d1c9ebf5b size: 16384
--> Deploying to Kubernetes
Release "tufted-lamb" does not exist. Installing it now.
--> Status: DEPLOYED
--> Notes:

http://tufted-lamb.example.com to access your application

Watch local files for changes …

Once it has successfully deployed, interact with your app to make sure everything works correctly.

Keep in mind that Draft is experimental at this time but is shaping up to be a useful tool for those who want to dive into the world of containers but did not know how.

Prakash Sarma

Prakash Sarma is the co-founder and Managing Partner of Newstar Corporation, focused on All Things Ecommerce. Prakash has spent the past decade building high traffic and scalable ecommerce platforms for numerous omnichannel retailers and B2C companies. A technologist at heart, with a product and revenue driven mindset, Prakash is passionate about Ecommerce, Distributed Systems, Cloud Platforms, Big Data, DevOps, and CI/CD. He frequently advises startups and presents and writes on these topics as well as innovation and culture transformations in enterprises.