A Habitat Operator for Kubernetes

For the last several months, our friends over at Kinvolk have been working on a Habitat operator for Kubernetes. This operator lets you easily stand up Habitat built containers on Kubernetes, and take advantage of the features of the Habitat supervisor directly through the Kubernetes API. You can get right to the code over on Kinvolk’s GitHub.

If you’ve followed along with our work around Kubernetes and Habitat, you’ll know we’ve had a goal of creating this operator, and Kelsey Hightower showed some ways you could easily integrate Habitat and Kubernetes. The advantage of this operator is that it gets rid of some of the bootstrapping and ordering issues we’ve had with Habitat on Kubernetes.

This operator leverages Kubernetes CustomResourceDefinitions to create a new resource called a ServiceGroup.

apiVersion: habitat.sh/v1
kind: ServiceGroup
 # Name must be the same as your service name in Habitat.
 name: mytutorialapp
 image: kinvolk/nodejs-hab
 count: 3
   topology: standalone
   group: nodejs
   # Create Secret with the initial configuration you want.
   config: user-toml-secret

The example above will spin up 3 containers (Pods) and will pass the Habitat Supervisor options as defined in resource. You can set the Habitat Supervisor topology, the service group, and where to pull a user.toml from. You can also choose a leader/follower topology and Habitat will perform a leader election to configure services that might require such a configuration. Check out more examples on GitHub including how to install the operator.

Watch the video below to see the operator in action. If you have questions you can join the Habitat Slack team, and jump into the #kubernetes channel. It’s still early days for this operator, so we’d love to hear your thoughts and experiences. Thanks again to our friends at Kinvolk.

Author Michael Ducy

Michael Ducy currently works as a Director of Product Marketing for Chef focusing on helping companies understand Chef, DevOps, and IT transformation. Previously, Michael focused on designing and implementing automation solutions for customer’s Cloud, IT Automation, and Continuous Delivery needs. Michael has also worked in a variety of roles in his career including Cloud Architecture, Systems Engineering , Performance Engineering, and IT Instructor. Michael holds a Masters in Computer Science from the University of Chicago and an MBA from The Ohio State University.