Top Banner
High Availability for Puppet Russ Mull - @mullr Senior Software Engineer Zack Smith - @acidprime Principal Professional Services Engineer
44

PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Apr 13, 2017

Download

Technology

Puppet
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet

Russ Mull - @mullr Senior Software Engineer

Zack Smith - @acidprime Principal Professional Services Engineer

Page 2: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Puppet Services related to High AvailabilityThe important bits of Puppet to make highly available

Page 3: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Enterprise Readiness: High Availability

Auto scaling Active/ Active

Robust Backup and Restore

tooling

Disaster recovery in Multi

datacenter/ Geo diverse

environments

Eliminate Single Points of Failure

Building capabilities that matter

Puppet Runs continue

Page 4: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Building a new catalogClassification, Exported Records, Hiera Data and puppet code being synced from version control

4

run

Puppet Code

Classifier

Page 5: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Two of Everything!don’t forget about your external services like git, ldap etc

5

Cl

Pup

Classifier

Pup

Classifier

Balancer“Load”

check

check backup

Page 6: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Lets start with the basics

Page 7: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Certificate Authority FilesPuppets SSL implementation

7

Page 8: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Puppet CA Replication Components

CA private key and cert

Signed Directory

Serial file

Certificate Revocation List (CRL)

8

serial

3E8

crl.pem

signed

101

ca_crt

Page 9: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

CA Private key

ca

If you don’t care about revocation (security/revocation) this is the only file needed to replicate

9

ca_key.pem

ssl

ca_crt.pem

Page 10: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Signed Directory

signed

Used when checking for duplicate CN ( certs with the same name)

10

host1.company.com.pem

ca

Page 11: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Serial fileTracking the next numeric serial to be issued to new agent

11

serial

ca

3E8

decimal: 1000

decimal: 10013E9

Page 12: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Certificate Revocation ListTracking revoked certificates

12

crl.pem

cadecimal: 1000

decimal: 1001

1000

1001

serial3E9

Page 13: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Simply copy your ssldir ahead of the second installation

13

$ssldirscp -r

$ssldir

installer

CA

When using old versions of PE delete the pe-internal* certs post transfer , pre install

DR site

1.

2.

Page 14: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

PostgreSQL ReplicationDatabase level synchronization

14

Page 15: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Streaming ReplicationThis happens as the postgres database layer

15

PostgreSQL PostgreSQL

PuppetDBPDB PuppetDBPDB

22

Read (Standby)Write

5432

write ahead logs

R

W1

2

16MB

Page 16: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Split Reads and writesCan survive temporary failures of the write master

16

PostgreSQL PostgreSQL

PuppetDBPDB

Read (Standby)Write

5432

W R

WWW

queue

Page 17: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Promote Standby to WritableThis happens as the postgres database layer

17

PostgreSQL

WriteRead (standby)

PostgreSQL

PostgreSQL

Write

5432

PostgreSQL

Read (standby)

5432

Page 18: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Multi master PuppetDB BetaPuppet Enterprise Only

18

Page 19: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Master side FailoverThis is know as “terminus” failover as its handled in the puppetdb terminus package code

19

PuppetDBPDB

[main] server_urls = https://primary:8081, https://replica:8081

Primary

PuppetDBPDB

Replica1 2

Page 20: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Command Broadcastcommand_broadcast = true in puppetdb.conf

20

PuppetDBPDBPuppetDBPDB

Page 21: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

PuppetDB Replication ReconciliationReconciliation happens on an interval

21

PostgreSQL

8081

Write

PostgreSQL

PuppetDBPDB

Write

PuppetDBPDB

Sync Interval

Page 22: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Puppet Enterprise HAComing soon…

22

Page 23: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Simple HAMonolithic master + Replica

23

P Primary R Replica

Page 24: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Large Environment InstallationMonolithic master + Compile masters + Replica

24

R Replica

BalancerLoad

P Primary

BalancerLoad

Page 25: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

New: Agent Side Failover!Shipping in Puppet 4.6 and higher, PE 2016.4+

25Primary Replica

1 2

Page 26: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Use Cases

● Puppet runs keep working

● Promote replica to master

26

When master is unreachable

Page 27: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

When the master is unreachable

● Run puppet

● Promote replica to master

27

You can:

You can’t● Change classification

● Deploy new puppet code

● Issue new certs

● Use the Puppet Enterprise Console

● Use Application Orchestrator

Page 28: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Provisioning Replica(monitoring replication)

28

Page 29: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Command Line Interface

29

puppet infra provision replica <hostname>replica.mycorp.net

puppet infra enable replica

replica.mycorp.net

puppet infra status. . .

Page 30: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

1. Provision Replica

30

puppet infra provision replica <hostname>replica.mycorp.net

Page 31: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

2. Monitor status of replication

31

puppet infra status> Per-service ‘alerts’> Visible in the UI as well

Page 32: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

3. Enable replica

32

puppet infra enable replicareplica.mycorp.net

Page 33: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Replica ServicesServices on a provisioned replica

33

Page 34: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

What’s a replica?

● Compile Master

● PuppetDB (r/w)

● RBAC, classifier, activity (r/o)

● Orchestrator data (not running)

● CA data (r/o using a proxy)

34

R ReplicaPuppetDBPDB

Console

Page 35: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

File Sync ReplicationReplicate Code Directory and Certificate Authority Data

35

Page 36: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

File Sync - Compile Masters

M

Master of Masters

MOM

Compile Master

COMC

Compile Master

COMC

Compile Master

COMC

Page 37: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

File Sync - CA Replica data

Primary Master Replica Master

R ReplicaP Primary

8140

ssl ssl

Page 38: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Puppet Enterprise CA Proxy

Primary Master Replica Master

R ReplicaP Primary

ssl CSR

Page 39: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

Database ReplicationReplicate the data used in your PE deployment

39

Page 40: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

PGLogical Replication

PostgreSQL

RBAC

NCClassifier 5432

5432

PostgreSQL

RBAC

NCClassifier

Write Read (Standby)

PuppetDBPDB

PuppetDBPDBNot synced

Page 41: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

PE HA - ReplicationPuppetDBPuppetDBPDB PuppetDBPDB

PostgreSQL PostgreSQL

PGlogical

PGlogical

FileSync

Primary Replica

RBAC

NCClassifier

W

W

RBAC

NCClassifier

R

R

Page 42: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

Puppet Enterprise HA - Beta Signup

Interested in what you heard? Please signup for our HA beta program through the Puppet Enterprise Support portal

42

Page 43: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet

High Availability for Puppet - Puppetconf 2016

43

https://goo.gl/Z85HLS

PE HA Beta Signup

Support Knowledge base

Z 8 5 H L S

Page 44: PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet