A Habitat Operator for Kubernetes
// Chef Blog
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 metadata: # Name must be the same as your service name in Habitat. name: mytutorialapp spec: image: kinvolk/nodejs-hab count: 3 habitat: 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.
Read in my feedly
Sent from my iPhone