Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Openshift Commons - PostgreSQL Operator Overview

Openshift Commons - PostgreSQL Operator Overview

an overview of the PostgreSQL Operator from Crunchy will be presented.

Jeff McCormick

July 19, 2017

Other Decks in Programming


  1. PostgreSQL Operator Overview Openshift Commons Briefing July 20, 2017

  2. About Crunchy Data… Leading provider of trusted open source PostgreSQL

    and PostgreSQL related technologies, support and training to enterprises. 2 Powering Innovation With The World’s Most Advanced Open Source Database
  3. Operator Basics

  4. 4 • Open Source - project at https://github.com/crunchydata/postgres-operator • controller

    - an Operator is essentially a controller component you run on your Kubernetes or Openshift cluster • automation - the Operator implements the necessary workflow orchestration logic to enable the automation of PostgreSQL related tasks • leverages the Kube API - the Operator is implemented in golang and leverages the Kubernetes Client API heavily to look for events, update labels, create containers, etc. https://github.com/kubernetes/client-go • Command Line Interface - the Operator has a Command Line Interface that lets human users manipulate the Operator and define metadata used to catalog your PostgreSQL deployments • deployment - the Operator runs as a standard Deployment, it watches for Third Party Resources that we define to manage PostgreSQL deployments • third party resources - the Operator makes use of Kubernetes Third Party Resources currently to store metadata about PostgreSQL deployments, this will change to using Kubernetes Custom Resource Definitions in future versions • custom PostgreSQL cluster definitions - a template based approach for allowing users an ability to define the makeup of a PostgreSQL cluster rather than the current default Operator Basics - What is it?
  5. 5 Operator Basics - What is it? TPR Operator pgo

    Client PostgreSQL Deployments PostgreSQL Deployments PostgreSQL Deployments PostgreSQL Deployments OpenShift
  6. PostgreSQL Cluster 6 Operator Basics - PostgreSQL Deployment Postgres Master

    Deployment master Service Master PVC Postgres Replica Deployment replica Service Replica PVC pod pod pod Replica PVC
  7. But why?

  8. 8 • automation - working with databases requires different workflows

    that involve multiple steps and verifications, the Operator allows for automating those sort of workflows in a consistent way and can reduce human errors; working with large numbers of complex database deployments can get time consuming without some sort of automation • standard practices - advanced users will want to have a standard set of database objects created so the ability to categorize databases with metadata and also build/apply SQL policies for them is useful to support a set of standards • ease of use - a simple CLI that is focused solely on deploying and managing a set of PostgreSQL clusters enables users to focus on getting real work done instead of having to build their own set of scripts or adjust to learning the details of kubectl commands • large scale deployments - the Operator supports environments where you might have possibly hundreds of PostgreSQL clusters deployed, the use of assigning metadata to deployed PostgreSQL clusters and being able to query these assets in a managed way is useful • complex orchestrations - the Operator provides a means of developing advanced database orchestration logic using a standards-based approach But why?
  9. Building Blocks

  10. 10 • crunchy-postgres - runs PostgreSQL and also performs a

    backup restore • crunchy-backup - performs a pg_basebackup on a database container • crunchy-upgrade – provides a means of performing a major PostgreSQL upgrade from one version to another • crunchy-proxy - provides a PostgreSQL SQL routing proxy The Crunchy Container Suite is an open source project found at: https://github.com/crunchydata/crunchy-containers Crunchy Container Suite The Operator leverages the following containers to deploy PostgreSQL:
  11. Operator Commands

  12. 12 • pgo create mycluster - create a PostgreSQL cluster

    deployment(s) • pgo delete mycluster - delete everything related to a PostgreSQL deployment including services, deployments • pgo show mycluster - display information for a PostgreSQL cluster(s) • pgo test mycluster - runs SQL tests against your PostgreSQL cluster • pgo show pvc mypvc - displays the contents of a PVC • pgo scale mycluster --replica-count=1 - add a PostgreSQL replica to the deployment • pgo backup mycluster - perform a full database backup of a PostgreSQL deployment • pgo create myrestored --backup-pvc=somepvc --backup-path=/somepath - create a restored database from a previous backup • pgo upgrade mycluster - perform either a minor or major PostgreSQL upgrade • pgo create policy - create a SQL-based policy • pgo apply mypolicy --selector=name=mycluster - apply a SQL-based policy against a PostgreSQL cluster(s) • pgo clone mycluster --name=myclone - clone an existing PostgreSQL cluster, creates a replica, waits for the replica to complete replication, decouples the replica from the master by triggering a recovery and re-labeling the replica to become a fully functioning master, creates a service for the new master and an empty replica deployment. Operator Commands
  13. Summary

  14. Summary •PostgreSQL operator is open sourced and available at https://github.com/crunchydata/postgres-operator

    •The Operator provides a means of controlling PostgreSQL deployments in a high level abstraction •The Operator integrates tightly with the Kubernetes API to implement orchestrated PostgreSQL workflows like backup, restore, cloning, policy management •Future versions of the Operator will add more advanced security and management features and support future Kubernetes APIs 14
  15. 15 QUESTIONS WWW.CRUNCHYDATA.COM [email protected] https://github.com/crunchydata/postgres-operator