Use Puppet to manage the Kubernetes configuration

Kubernetes is a Google open source container cluster management system that provides application deployment, maintenance, and extension mechanisms that enable Kubernetes to easily manage cross-machine-run containerized applications. With the new Puppet module, you can use the Puppet language for Kubernetes to manage Pods, RC, Services, and so on.

Getting started with Kubernetes

The KubeCon conference demonstrates the results of Kubernetes, a Google open source Linux container cluster management tool that is designed to manage its internal infrastructure. Kubernetes aims to simplify the management of complex distributed systems by introducing a set of core elements and APIs. Companies such as eBay, SoundCloud and RedHat adopt this new approach when they build applications, systems and infrastructure.

Now with the new Kubernetes Puppet module, we can now use Puppet to manage the Kubernetes resources, such as RCs, Pods, and Services.

Configuration management: narration

When talking about Puppet and Kubernetes, you can simplify it to a higher level topic – configuration management. Some people use configuration management (such as Puppet) as a way to manage "host-intensive" resources, where host-intensive resources refer to files, services, packages, users, and user groups. Kubernetes abstracts high-level basic elements such as Pods and RCs, designed to simplify the management of distributed scalable systems. Thanks to these new basic elements, perhaps we no longer need to configure the management.

But the configuration management is really a very wide range of disciplines, can be traced back to the twentieth century, the fifties. My favorite description of the configuration management system capability comes from the Military Handbook Configuration Management Guide MIL-HDBK-61B, which describes:

  • Identification
  • control
  • Status statistics
  • Checksum audit

The problems associated with these functions are ubiquitous in the system and exist in Kubernetes, and at present only partially can be solved by native tools – like managing configuration drift problems, using a separate, well-defined change control Mechanisms and models that exist outside of Kubernetes in the infrastructure. This is also becoming more important, as in a variety of production environments deployed, there will be a lot of technology is mutually supportive.

Use Puppet to manage Kubernetes

The new Kubernetes Puppet module allows you to use Kuppnet's specific domain language to manage Kubernetes' resources – the RCs, Services, and Pods instances. this means:

  • This will be faster and easier to manage the state of Kubernetes resources, the use of the source code and application code can be used with the version of the mark.
  • By using Puppet's built-in reports and tools like PuppetDB, it's easy to get the real state of the Kubernetes cluster.
  • If you have already used Puppet, then Kubernetes' Puppet module will provide a convenient way to manage Kubernetes and your other infrastructure.

This module has not yet been installed or managed to make Kubernetes various components, although this area already has a very good platform to provide services like OpenShift, Tectonic from CoreOS or GCE.

This module allows you to define Kubernetes resources in Puppet and then use Puppet to create and update these resources for a period of time.

Puppet code user interface is modeled on Kubernetes YAML format. This interface is also familiar to people who have used the Kubernetes API, and at the same time provide low-level building blocks in Puppet to create high-level types.

  Kubernetes_pod {'sample-pod': 
Ensure => present,
Metadata => {
Namespace => 'default',
Spec => {
Containers => [{
Name => 'container-name',
Image => 'nginx',

The module now supports the following types:

  • Kubernetes_pod
  • Kubernetes_service
  • Kubernetes_replication_controller
  • Kubernetes_node
  • Kubernetes_event
  • Kubernetes_endpoint
  • Kubernetes_namespace
  • Kubernetes_secret
  • Kubernetes_resource_quota
  • Kubernetes_limit_range
  • Kubernetes_peristent_volume
  • Kubernetes_persistent_volume_claim
  • Kubernetes_component_status
  • Kubernetes_service_account

Not all of these can be created through the API, but they have the right to query Puppet resources. For example, if you want to know if the current node is in the Kubernetes cluster, you can run:

  $ Puppet resource kubernetes_node 

Puppet resources can also be used to derive the state of a running cluster into a Puppet manifest file that can be used as a basis for maintaining a cluster state over a period of time.

Why is Puppet?

Using Puppet to manage Kubernetes over the underlying YAML file in the following areas:

  • The Puppet language supports logic and abstraction, allowing itself to define a business-specific user interface. You can create high-level types, and then instantiate multiple copies.
  • Puppet's code can be modified, and then Puppet will handle the update-related resources. You do not have to describe the full state of the resource, or manually modify the personal resources through the command line interface (CLI).
  • Puppet has tool validation code and write unit tests as well as distribute and share reusable modules.
  • Puppet supports the existence of a relationship between resources, so you can execute the command if necessary. Through the new application of the choreography, you can even use Kubernetes on some of the infrastructure to execute commands across nodes.

Source: Managing Kubernetes Configuration with Puppet

Heads up! This alert needs your attention, but it's not super important.