DEV Community

loading...

Deploying Kuma Service Mesh with Puppet Bolt

Martez Reed
Director of Technical Marketing at Morpheus Data
Originally published at martezreed.Medium on ・3 min read

Kuma is a platform agnostic open-source control plane for service mesh and microservices management, with support for Kubernetes, VM, and bare metal environments. Kubernetes has quickly become the de facto platform on which new applications are being built to take advantage of the benefits that come with containerization. The challenge that many organizations are facing is integrating containerized workloads in Kubernetes with VM based workloads in a meaningful way. In this case Kuma service mesh can be used to provide the benefits of service mesh in a k8s/vm hybrid scenario.

In this blog post we’ll take a look at how to use Puppet Bolt to deploy the universal version of the Kuma service mesh control plane intended for virtual machines.

Initialize the Bolt project

Ensure that the latest version of Puppet Bolt is installed before getting started.

Puppet Bolt utilizes Project directories as launching points for running Bolt operations. Create a directory for our Puppet Bolt project name kumamesh.

mkdir kumamesh
Enter fullscreen mode Exit fullscreen mode

Change the working directory to kumamesh directory

cd kumamesh
Enter fullscreen mode Exit fullscreen mode

Now that we have a directory for hosting our Bolt project, we need to initialize the project.

bolt project init
Enter fullscreen mode Exit fullscreen mode

Add the puppet-kuma module from the associated Github repository to the bolt-project.yaml file.

--------
name: kumamesh
modules:
  - git: [https://github.com/martezr/puppet-kuma.git](https://github.com/martezr/puppet-kuma.git)
    ref: 'main'
Enter fullscreen mode Exit fullscreen mode

Install the module and its dependencies.

bolt module install
Enter fullscreen mode Exit fullscreen mode

Create the Bolt plan

In order to utilize plans in Bolt, we need to create a directory named plans.

mkdir plans
Enter fullscreen mode Exit fullscreen mode

Now that we have our plans directory created we’ll use the Kuma service mesh module to install the Kuma service mesh control plane backed by a PostgreSQL database.

Create a file named controlplane.pp with the following content in the plans directory.

plan kumamesh::controlplane (
  TargetSpec $targets
) {
  apply_prep($targets)
  apply($targets){

    class { 'kuma':
      version => '1.1.1',
    }

    class { 'kuma::controlplane':
      manage_postgres => true,
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Now that we’ve created our plan we can ensure that it’s recognized by Bolt by running the following command.

bolt plan show
Enter fullscreen mode Exit fullscreen mode

If the plan registers properly the output should include a kumamesh_::controlplane_ entry.

Plans
  aggregate::count                    
  aggregate::targets                  
  canary                              
  facts                               
  facts::external                     
  facts::info                         
  **kumamesh::controlplane**              
  puppet_agent::run                   
  puppet_connect::test_input_data     
  puppetdb_fact                       
  reboot                              
  secure_env_vars                     
  terraform::apply
  terraform::destroy
Enter fullscreen mode Exit fullscreen mode

With the plan registered we are now ready to run the plan by running the bolt plan run kumamesh::controlplane command. We’ve specified the target which is the node we want to install the control plane on. In this example we’ve used IP addresses but resolvable hostnames could have been used as well.

bolt plan run kumamesh::controlplane --target 10.0.0.111
Enter fullscreen mode Exit fullscreen mode

If the plan ran successfully it should have generated output similar to that displayed below.

Starting: plan kumamesh::controlplane
Starting: install puppet and gather facts on 10.0.0.111
Finished: install puppet and gather facts with 0 failures in 12.07 sec
Starting: apply catalog on 10.0.0.111
Finished: apply catalog with 0 failures in 53.15 sec
Finished: plan kumamesh::controlplane in 1 min, 6 sec
Plan completed successfully with no result

Plan completed successfully with no result
Enter fullscreen mode Exit fullscreen mode

Once the plan has completed successfully we can now view the control plane GUI by browsing to http://controlplane_ip:5681/gui.

Discussion (0)