April 5, 2019

Install and Configure Kubernetes with a Puppet Module

Ecosystems & Integrations
How to & Use Cases

Containerization has immense potential for development, particularly in cloud environments. The benefits of virtualizing a portable computing environment are attractive for any organization to make their DevOps approach faster and more flexible.

This blog provides a quick overview of how Puppet and Kubernetes work and how to use the Puppet Kubernetes module to install, bootstrap, and configure Kubernetes using Puppet.

Back to top

How Do Puppet and Kubernetes Work?

Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications (containers that make up an application are grouped into logical units). Puppet's configuration management capabilities can be used to solve several problems within Kubernetes, including identification, control, status accounting and verification, and audit.

Back to top

What the Puppet Kubernetes Module Does

The Kubernetes module for Puppet is used to install and configure Kubernetes. Puppet is a certified Kubernetes installer by the Cloud Native Computing Foundation.

The module installs and configures Kubernetes, allowing the deployment of Kubernetes clusters to be managed using either open source Puppet or Puppet Enterprise. Puppet will maintain the state of your Kubernetes cluster automatically.

OSP vs. Puppet Enterprise

Is it time to switch?


A graphic of a guide by Puppet. Title: A Business Guide to Open Source Puppet vs. Puppet Enterprise

Using this module will help you deploy Kubernetes quicker, using the Puppet Desired State Language (DSL) to define the state. It is fully open source and community contributions are welcome. The module uses the kubeadm toolkit to bootstrap the Kubernetes cluster.

Back to top

Try Out the Puppet Kubernetes Sandbox

If you're new to Kubernetes and want get a basic cluster running with a controller and two workers, you're in luck. Kubernetes Rules Everything Around Me (KREAM) is a development environment for the Puppet Kubernetes module that can help you get up to speed.

Watch the below video for a tutorial on installing and configuring a Kubernetes cluster:

Back to top

How Install and Configure Kubernetes with Puppet

Install the Puppet Kubernetes Module

Start by downloading the Puppet Kubernetes module from the Puppet Forge. The module comes with a kubetool which will generate the yaml configuration for your Kubernetes deployment. The files produced for each member of the etcd cluster contain certificate information to bootstrap an initial etcd cluster.

Add the Configuration Files to Hiera

Next, add the configuration files generated by the kubetool to Hiera. Each cluster can be allocated its own configuration.

Configure Your Controller or Worker Nodes

Now it's time to configure the nodes. There can be controller and worker nodes. A node be either controller or worker, but not both.

To configure a controller note, add the following code to a manifest:

class {'kubernetes':
controller => true,

To configure a worker note, add this code instead:

class {'kubernetes':
worker => true,

Using the module in this way will keep your Kubernetes installation consistently enforced based on the manifests used for its creation, and Puppet will prevent any drift. Keep in mind that the module does not control any containerized applications deployed to the Kubernetes cluster.



Learn More

Back to top