SlideShare a Scribd company logo
Dylan Cochran, Onyx Point
X
Integrating Consul and
Puppet
Dylan Cochran
Systems Engineer
OnyxPoint, Inc
Dylan Cochran, Onyx Point
X
[
●What is Consul?
●How Consul works
●Setting up a cluster
●Service discovery
●Lock management
●Direct Access in Puppet
●Atomic operations
●Using Consul as a hiera backend
OVERVIEW]
Dylan Cochran, Onyx Point
X
[
Consul is fundamentally a tool for discovering and configuring
services in your infrastructure
●Service Discovery
●Health Checking
●KV Store
●Lock Management
●Distributed Events
●Multi-Datacenter
WHAT IS CONSUL - 1]
Dylan Cochran, Onyx Point
X
[
Each node in the cluster runs a consul agent.
All agents attempt to communicate with all other agents using
a gossip protocol, to exchange service health information and
ip address data.
Every datacenter cluster requires at least one ‘server’ node.
Servers contain the entire KV store and database, and are
considered ‘equals’. Normal agents have to connect to a
server to access these components.
HOW IT WORKS - 1]
Dylan Cochran, Onyx Point
X
[HOW IT WORKS - 2]
Dylan Cochran, Onyx Point
X
[
It is recommended to have 3 to 7 server nodes. Consul is
strongly consistent, so a majority of server nodes must be
available in a datacenter.
HOW IT WORKS - 3]
1 node = 0 failures
2 nodes = 0 failures
3 nodes = 1 failure
4 nodes = 1 failure
5 nodes = 2 failures
6 nodes = 2 failures
7 nodes = 3 failures
Dylan Cochran, Onyx Point
X
[
We will be using the most well maintained module on the
forge:
mod 'KyleAnderson-consul'
It provides classes to install/configure consul on most
platforms, as well as helper types to define consul services
and health checks.
SETTING UP A CLUSTER- 1]
Dylan Cochran, Onyx Point
X
[
class { "::consul":
version => '0.9.2',
config_hash => {
'node_name' => $::hostname,
'advertise_addr' => $::ipaddress,
'retry_join' => [ $::ipaddress ],
'server' => true,
'bootstrap_expect' => 1,
},
}
SETTING UP A CLUSTER- 2]
Dylan Cochran, Onyx Point
X
[
Once the first server has been initialized, remove bootstrap-
expect. All other nodes (servers and clients) should try to
retry-join the first server to get bootstrapped
Afterwards, any joined server is valid to attempt to connect to,
as the gossip pool has been started.
You can also enable encryption using the consul keygen
command, and adding an ‘encrypt’ option to the config hash.
This will encrypt the gossip pool communication.
SETTING UP A CLUSTER- 3]
Dylan Cochran, Onyx Point
X
[
You can verify the cluster is working by running `consul
members` on any agent:
dcochran-laptop ~> consul members
Node Address Status Type Build Protocol DC
dcochran-laptop 192.168.27.100:8301 alive client 0.9.2 2 dc1
webserver1 192.168.27.20:8301 alive client 0.9.2 2 dc1
server1 192.168.27.5:8301 alive server 0.9.2 2 dc1
SETTING UP A CLUSTER- 4]
Dylan Cochran, Onyx Point
X
[
consul::service { 'puppet':
checks => [
{
http => 'https://localhost:8140/',
interval => '5s',
},
],
port => 8140,
tags => ['ca'],
}
We can see the result by querying the dns api on port 8600:
dcochran-laptop ~> dig +nocmd +noall +answer -p 8600 @127.0.0.1 ca.puppet.service.consul
ca.puppet.service.consul. 0 IN A 192.168.27.20
SERVICE DISCOVERY]
Dylan Cochran, Onyx Point
X
[
Consul provides a built-in distributed lock manager, as well as
an interface using the consul lock command. This can be used
to provide exclusive access, as well as ‘up to N’ levels
consul lock -pass-stdin -verbose /test top
consul lock /production-db-upgrade mysql-db-upgrade
consul lock -n 4 /puppet-agent puppet agent -t
LOCK MANAGEMENT - 1]
Dylan Cochran, Onyx Point
X
[
We can leverage this feature to do rolling restarts of services
in puppet:
exec { "RestartColdfusion":
command => "/usr/local/bin/consul lock coldfusion-restart
/sbin/service coldfusion restart",
}
LOCK MANAGEMENT - 2]
Dylan Cochran, Onyx Point
X
[
We’ve created a puppet module, that allows for read/write
access to consul directly in puppet code. It provides a set of
custom functions that expose a lot of the KV store API.
Libkv Module:
- https://github.com/simp/pupmod-simp-libkv
DIRECT PUPPET ACCESS - 1]
Dylan Cochran, Onyx Point
X
[
To start using the functions, you need to specify the url to the
consul server:
libkv::url: 'consul://localhost:8500/puppet'
And adding dependency to your metadata.json:
"dependencies": [
{
"name": "simp/libkv",
"version_requirement": ">=0.1.0"
}
],
DIRECT PUPPET ACCESS - 2]
Dylan Cochran, Onyx Point
X
[
Classic Exported resources:
@@host { $::fqdn:
ip => $::ipaddress,
tags => [ 'mystuff' ],
}
Host <<| tags == 'mystuff' |>>
DIRECT PUPPET ACCESS - 3]
Dylan Cochran, Onyx Point
X
[
libkv::put("/hosts/${::clientcert}", $::ipaddress)
$hosts = libkv::list("/hosts")
$hosts.each |$host, $ip | {
host { $host:
ip => $ip,
}
}
DIRECT PUPPET ACCESS - 4]
Dylan Cochran, Onyx Point
X
[
What about a system like zookeeper, that requires every
server to have a unique id number, between 1-255? We need
to be able to allocate these numbers on demand, and ensure
that it never gets reallocated
fqdn_rand() sounds like a good idea, but it has a tendency to
favor lower id numbers, and will never guarantee uniqueness
ATOMIC OPERATIONS - 1]
Dylan Cochran, Onyx Point
X
[
To implement this, we need some way so that when you use
‘include zookeeper’, it will allocate a unique id to every new
server classified, always.
Consul provides a mechanism to do this, which is its ‘atomic
operations’.
When you use an atomic function, it uses a special object,
which contains the index of the last change made, and asserts
that the ‘put’ should only succeed if the index is the same.
ATOMIC OPERATIONS - 2]
Dylan Cochran, Onyx Point
X
[
if (libkv::exists("/serverid/${clientcert}")) {
$id = libkv::get("/serverid/${clientcert}")
} else {
$oldvalue = libkv::atomic_get("/serverid/current")
if ($oldvalue == libkv::empty_value()) {
$newvalue = 1
} else {
$newvalue = $oldvalue["value"] + 1
}
$result = libkv::atomic_put("/serverid/current", $newvalue, $oldvalue)
if ($result == true) {
libkv::put("/serverid/${::clientcert}", $newvalue)
$id = $newvalue
} else {
fail("unable to allocate serverid")
}
}
ATOMIC OPERATIONS - 3]
Dylan Cochran, Onyx Point
X
[
Remember that in the real world, it can and does fail. If you
don’t want to fail your catalog compile, you can loop over the
result, and re-increment
Because this is such a common process, a libkv::loop function
is on the roadmap.
ATOMIC OPERATIONS - 4]
Dylan Cochran, Onyx Point
X
[
We can also use consul as a Hiera backend. This will convert
hiera keys like ‘apache::username’ into a consul request to
‘/puppet/hiera/apache::username’.
It supports all interpolation and layering as other hiera
backends
HIERA - 1]
Dylan Cochran, Onyx Point
X
[
---
version: 5
defaults:
datadir: "data"
data_hash: "yaml_data"
hierarchy:
- name: "Libkv - per-host"
lookup_key: "libkv::lookup"
uri: "consul://127.0.0.1:8500/puppet/hiera/hosts/%{trusted.certname}"
- name: "Libkv - general"
lookup_key: "libkv::lookup"
uri: "consul://127.0.0.1:8500/puppet/hiera/common"
HIERA - 2]
Dylan Cochran, Onyx Point
X
[HIERA - 3]
Dylan Cochran, Onyx Point
X
LESSONS
LEARNED
Dylan Cochran
Onyx Point, Inc.
dylan.cochran@onyxpoint.com

More Related Content

What's hot

Docker 1.12 and swarm mode
Docker 1.12 and swarm modeDocker 1.12 and swarm mode
Docker 1.12 and swarm mode
Wesley Charles Blake
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm Updated
Docker, Inc.
 
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Using Node.js to  Build Great  Streaming Services - HTML5 Dev ConfUsing Node.js to  Build Great  Streaming Services - HTML5 Dev Conf
Using Node.js to Build Great Streaming Services - HTML5 Dev ConfTom Croucher
 
Load Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINXLoad Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINX
NGINX, Inc.
 
Docker in production service discovery with consul - road to opscon 2015
Docker in production  service discovery with consul - road to opscon 2015Docker in production  service discovery with consul - road to opscon 2015
Docker in production service discovery with consul - road to opscon 2015
Giovanni Toraldo
 
Rally - Benchmarking_as_a_service - Openstack meetup
Rally - Benchmarking_as_a_service - Openstack meetupRally - Benchmarking_as_a_service - Openstack meetup
Rally - Benchmarking_as_a_service - Openstack meetupAnanth Padmanabhan
 
The age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster managementThe age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster management
Nicola Paolucci
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
Mike Pittaro
 
Ice mini guide
Ice mini guideIce mini guide
Ice mini guide
Ady Liu
 
Docker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker SwarmDocker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker Swarm
Docker, Inc.
 
openstack源码分析(1)
openstack源码分析(1)openstack源码分析(1)
openstack源码分析(1)cannium
 
Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview
Thomas Chacko
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
Marcus Lönnberg
 
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Brice Argenson
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2
Fernando Lopez Aguilar
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0
Docker, Inc.
 
Node.js streaming csv downloads proxy
Node.js streaming csv downloads proxyNode.js streaming csv downloads proxy
Node.js streaming csv downloads proxy
Ismael Celis
 
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
Docker, Inc.
 
Behind modern concurrency primitives
Behind modern concurrency primitivesBehind modern concurrency primitives
Behind modern concurrency primitives
Bartosz Sypytkowski
 
Sharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's FinagleSharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's Finagle
Geoff Ballinger
 

What's hot (20)

Docker 1.12 and swarm mode
Docker 1.12 and swarm modeDocker 1.12 and swarm mode
Docker 1.12 and swarm mode
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm Updated
 
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Using Node.js to  Build Great  Streaming Services - HTML5 Dev ConfUsing Node.js to  Build Great  Streaming Services - HTML5 Dev Conf
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
 
Load Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINXLoad Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINX
 
Docker in production service discovery with consul - road to opscon 2015
Docker in production  service discovery with consul - road to opscon 2015Docker in production  service discovery with consul - road to opscon 2015
Docker in production service discovery with consul - road to opscon 2015
 
Rally - Benchmarking_as_a_service - Openstack meetup
Rally - Benchmarking_as_a_service - Openstack meetupRally - Benchmarking_as_a_service - Openstack meetup
Rally - Benchmarking_as_a_service - Openstack meetup
 
The age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster managementThe age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster management
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
 
Ice mini guide
Ice mini guideIce mini guide
Ice mini guide
 
Docker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker SwarmDocker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker Swarm
 
openstack源码分析(1)
openstack源码分析(1)openstack源码分析(1)
openstack源码分析(1)
 
Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
 
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0
 
Node.js streaming csv downloads proxy
Node.js streaming csv downloads proxyNode.js streaming csv downloads proxy
Node.js streaming csv downloads proxy
 
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
 
Behind modern concurrency primitives
Behind modern concurrency primitivesBehind modern concurrency primitives
Behind modern concurrency primitives
 
Sharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's FinagleSharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's Finagle
 

Similar to Integrating Consul and Puppet

Workshop Consul .- Service Discovery & Failure Detection
Workshop Consul .- Service Discovery & Failure DetectionWorkshop Consul .- Service Discovery & Failure Detection
Workshop Consul .- Service Discovery & Failure Detection
Vincent Composieux
 
Cutting through the fog of cloud
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloud
Kyle Rames
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-docker
Kidong Lee
 
Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)
Eran Harel
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
Yevgeniy Brikman
 
Introduction to Marionette Collective
Introduction to Marionette CollectiveIntroduction to Marionette Collective
Introduction to Marionette Collective
Puppet
 
20190727 HashiCorp Consul Workshop: 管管你們家 config 啦
20190727 HashiCorp Consul Workshop: 管管你們家 config 啦20190727 HashiCorp Consul Workshop: 管管你們家 config 啦
20190727 HashiCorp Consul Workshop: 管管你們家 config 啦
Jiun-Yi Chen
 
Evolution of kube-proxy (Brussels, Fosdem 2020)
Evolution of kube-proxy (Brussels, Fosdem 2020)Evolution of kube-proxy (Brussels, Fosdem 2020)
Evolution of kube-proxy (Brussels, Fosdem 2020)
Laurent Bernaille
 
Easy Cloud Native Transformation using HashiCorp Nomad
Easy Cloud Native Transformation using HashiCorp NomadEasy Cloud Native Transformation using HashiCorp Nomad
Easy Cloud Native Transformation using HashiCorp Nomad
Bram Vogelaar
 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akka
nartamonov
 
Tick Stack - Listen your infrastructure and please sleep
Tick Stack - Listen your infrastructure and please sleepTick Stack - Listen your infrastructure and please sleep
Tick Stack - Listen your infrastructure and please sleep
Gianluca Arbezzano
 
A Node.js Developer's Guide to Bluemix
A Node.js Developer's Guide to BluemixA Node.js Developer's Guide to Bluemix
A Node.js Developer's Guide to Bluemix
ibmwebspheresoftware
 
Simple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE LabSimple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE Lab
Fernando Lopez Aguilar
 
Oracle Connection Manager
Oracle Connection ManagerOracle Connection Manager
Oracle Connection Manager
Viaggio Italia
 
Spark with kubernates
Spark with kubernatesSpark with kubernates
Spark with kubernates
David Tung
 
Python Hashlib & A True Story of One Bug
Python Hashlib & A True Story of One BugPython Hashlib & A True Story of One Bug
Python Hashlib & A True Story of One Bug
delimitry
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
Terry Cho
 
K8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals Training
Piotr Perzyna
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
Docker, Inc.
 
RabbitMQ in Sprayer
RabbitMQ in SprayerRabbitMQ in Sprayer
RabbitMQ in Sprayer
Alvaro Saurin
 

Similar to Integrating Consul and Puppet (20)

Workshop Consul .- Service Discovery & Failure Detection
Workshop Consul .- Service Discovery & Failure DetectionWorkshop Consul .- Service Discovery & Failure Detection
Workshop Consul .- Service Discovery & Failure Detection
 
Cutting through the fog of cloud
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloud
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-docker
 
Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
 
Introduction to Marionette Collective
Introduction to Marionette CollectiveIntroduction to Marionette Collective
Introduction to Marionette Collective
 
20190727 HashiCorp Consul Workshop: 管管你們家 config 啦
20190727 HashiCorp Consul Workshop: 管管你們家 config 啦20190727 HashiCorp Consul Workshop: 管管你們家 config 啦
20190727 HashiCorp Consul Workshop: 管管你們家 config 啦
 
Evolution of kube-proxy (Brussels, Fosdem 2020)
Evolution of kube-proxy (Brussels, Fosdem 2020)Evolution of kube-proxy (Brussels, Fosdem 2020)
Evolution of kube-proxy (Brussels, Fosdem 2020)
 
Easy Cloud Native Transformation using HashiCorp Nomad
Easy Cloud Native Transformation using HashiCorp NomadEasy Cloud Native Transformation using HashiCorp Nomad
Easy Cloud Native Transformation using HashiCorp Nomad
 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akka
 
Tick Stack - Listen your infrastructure and please sleep
Tick Stack - Listen your infrastructure and please sleepTick Stack - Listen your infrastructure and please sleep
Tick Stack - Listen your infrastructure and please sleep
 
A Node.js Developer's Guide to Bluemix
A Node.js Developer's Guide to BluemixA Node.js Developer's Guide to Bluemix
A Node.js Developer's Guide to Bluemix
 
Simple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE LabSimple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE Lab
 
Oracle Connection Manager
Oracle Connection ManagerOracle Connection Manager
Oracle Connection Manager
 
Spark with kubernates
Spark with kubernatesSpark with kubernates
Spark with kubernates
 
Python Hashlib & A True Story of One Bug
Python Hashlib & A True Story of One BugPython Hashlib & A True Story of One Bug
Python Hashlib & A True Story of One Bug
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
K8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals Training
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
RabbitMQ in Sprayer
RabbitMQ in SprayerRabbitMQ in Sprayer
RabbitMQ in Sprayer
 

Recently uploaded

Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
Laura Szabó
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
harveenkaur52
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
CIOWomenMagazine
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
nhiyenphan2005
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
cuobya
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
vmemo1
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 

Recently uploaded (20)

Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 

Integrating Consul and Puppet

  • 1. Dylan Cochran, Onyx Point X Integrating Consul and Puppet Dylan Cochran Systems Engineer OnyxPoint, Inc
  • 2. Dylan Cochran, Onyx Point X [ ●What is Consul? ●How Consul works ●Setting up a cluster ●Service discovery ●Lock management ●Direct Access in Puppet ●Atomic operations ●Using Consul as a hiera backend OVERVIEW]
  • 3. Dylan Cochran, Onyx Point X [ Consul is fundamentally a tool for discovering and configuring services in your infrastructure ●Service Discovery ●Health Checking ●KV Store ●Lock Management ●Distributed Events ●Multi-Datacenter WHAT IS CONSUL - 1]
  • 4. Dylan Cochran, Onyx Point X [ Each node in the cluster runs a consul agent. All agents attempt to communicate with all other agents using a gossip protocol, to exchange service health information and ip address data. Every datacenter cluster requires at least one ‘server’ node. Servers contain the entire KV store and database, and are considered ‘equals’. Normal agents have to connect to a server to access these components. HOW IT WORKS - 1]
  • 5. Dylan Cochran, Onyx Point X [HOW IT WORKS - 2]
  • 6. Dylan Cochran, Onyx Point X [ It is recommended to have 3 to 7 server nodes. Consul is strongly consistent, so a majority of server nodes must be available in a datacenter. HOW IT WORKS - 3] 1 node = 0 failures 2 nodes = 0 failures 3 nodes = 1 failure 4 nodes = 1 failure 5 nodes = 2 failures 6 nodes = 2 failures 7 nodes = 3 failures
  • 7. Dylan Cochran, Onyx Point X [ We will be using the most well maintained module on the forge: mod 'KyleAnderson-consul' It provides classes to install/configure consul on most platforms, as well as helper types to define consul services and health checks. SETTING UP A CLUSTER- 1]
  • 8. Dylan Cochran, Onyx Point X [ class { "::consul": version => '0.9.2', config_hash => { 'node_name' => $::hostname, 'advertise_addr' => $::ipaddress, 'retry_join' => [ $::ipaddress ], 'server' => true, 'bootstrap_expect' => 1, }, } SETTING UP A CLUSTER- 2]
  • 9. Dylan Cochran, Onyx Point X [ Once the first server has been initialized, remove bootstrap- expect. All other nodes (servers and clients) should try to retry-join the first server to get bootstrapped Afterwards, any joined server is valid to attempt to connect to, as the gossip pool has been started. You can also enable encryption using the consul keygen command, and adding an ‘encrypt’ option to the config hash. This will encrypt the gossip pool communication. SETTING UP A CLUSTER- 3]
  • 10. Dylan Cochran, Onyx Point X [ You can verify the cluster is working by running `consul members` on any agent: dcochran-laptop ~> consul members Node Address Status Type Build Protocol DC dcochran-laptop 192.168.27.100:8301 alive client 0.9.2 2 dc1 webserver1 192.168.27.20:8301 alive client 0.9.2 2 dc1 server1 192.168.27.5:8301 alive server 0.9.2 2 dc1 SETTING UP A CLUSTER- 4]
  • 11. Dylan Cochran, Onyx Point X [ consul::service { 'puppet': checks => [ { http => 'https://localhost:8140/', interval => '5s', }, ], port => 8140, tags => ['ca'], } We can see the result by querying the dns api on port 8600: dcochran-laptop ~> dig +nocmd +noall +answer -p 8600 @127.0.0.1 ca.puppet.service.consul ca.puppet.service.consul. 0 IN A 192.168.27.20 SERVICE DISCOVERY]
  • 12. Dylan Cochran, Onyx Point X [ Consul provides a built-in distributed lock manager, as well as an interface using the consul lock command. This can be used to provide exclusive access, as well as ‘up to N’ levels consul lock -pass-stdin -verbose /test top consul lock /production-db-upgrade mysql-db-upgrade consul lock -n 4 /puppet-agent puppet agent -t LOCK MANAGEMENT - 1]
  • 13. Dylan Cochran, Onyx Point X [ We can leverage this feature to do rolling restarts of services in puppet: exec { "RestartColdfusion": command => "/usr/local/bin/consul lock coldfusion-restart /sbin/service coldfusion restart", } LOCK MANAGEMENT - 2]
  • 14. Dylan Cochran, Onyx Point X [ We’ve created a puppet module, that allows for read/write access to consul directly in puppet code. It provides a set of custom functions that expose a lot of the KV store API. Libkv Module: - https://github.com/simp/pupmod-simp-libkv DIRECT PUPPET ACCESS - 1]
  • 15. Dylan Cochran, Onyx Point X [ To start using the functions, you need to specify the url to the consul server: libkv::url: 'consul://localhost:8500/puppet' And adding dependency to your metadata.json: "dependencies": [ { "name": "simp/libkv", "version_requirement": ">=0.1.0" } ], DIRECT PUPPET ACCESS - 2]
  • 16. Dylan Cochran, Onyx Point X [ Classic Exported resources: @@host { $::fqdn: ip => $::ipaddress, tags => [ 'mystuff' ], } Host <<| tags == 'mystuff' |>> DIRECT PUPPET ACCESS - 3]
  • 17. Dylan Cochran, Onyx Point X [ libkv::put("/hosts/${::clientcert}", $::ipaddress) $hosts = libkv::list("/hosts") $hosts.each |$host, $ip | { host { $host: ip => $ip, } } DIRECT PUPPET ACCESS - 4]
  • 18. Dylan Cochran, Onyx Point X [ What about a system like zookeeper, that requires every server to have a unique id number, between 1-255? We need to be able to allocate these numbers on demand, and ensure that it never gets reallocated fqdn_rand() sounds like a good idea, but it has a tendency to favor lower id numbers, and will never guarantee uniqueness ATOMIC OPERATIONS - 1]
  • 19. Dylan Cochran, Onyx Point X [ To implement this, we need some way so that when you use ‘include zookeeper’, it will allocate a unique id to every new server classified, always. Consul provides a mechanism to do this, which is its ‘atomic operations’. When you use an atomic function, it uses a special object, which contains the index of the last change made, and asserts that the ‘put’ should only succeed if the index is the same. ATOMIC OPERATIONS - 2]
  • 20. Dylan Cochran, Onyx Point X [ if (libkv::exists("/serverid/${clientcert}")) { $id = libkv::get("/serverid/${clientcert}") } else { $oldvalue = libkv::atomic_get("/serverid/current") if ($oldvalue == libkv::empty_value()) { $newvalue = 1 } else { $newvalue = $oldvalue["value"] + 1 } $result = libkv::atomic_put("/serverid/current", $newvalue, $oldvalue) if ($result == true) { libkv::put("/serverid/${::clientcert}", $newvalue) $id = $newvalue } else { fail("unable to allocate serverid") } } ATOMIC OPERATIONS - 3]
  • 21. Dylan Cochran, Onyx Point X [ Remember that in the real world, it can and does fail. If you don’t want to fail your catalog compile, you can loop over the result, and re-increment Because this is such a common process, a libkv::loop function is on the roadmap. ATOMIC OPERATIONS - 4]
  • 22. Dylan Cochran, Onyx Point X [ We can also use consul as a Hiera backend. This will convert hiera keys like ‘apache::username’ into a consul request to ‘/puppet/hiera/apache::username’. It supports all interpolation and layering as other hiera backends HIERA - 1]
  • 23. Dylan Cochran, Onyx Point X [ --- version: 5 defaults: datadir: "data" data_hash: "yaml_data" hierarchy: - name: "Libkv - per-host" lookup_key: "libkv::lookup" uri: "consul://127.0.0.1:8500/puppet/hiera/hosts/%{trusted.certname}" - name: "Libkv - general" lookup_key: "libkv::lookup" uri: "consul://127.0.0.1:8500/puppet/hiera/common" HIERA - 2]
  • 24. Dylan Cochran, Onyx Point X [HIERA - 3]
  • 25. Dylan Cochran, Onyx Point X LESSONS LEARNED Dylan Cochran Onyx Point, Inc. dylan.cochran@onyxpoint.com