Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
Go to file
zerg-junior 26670408c4
Revert "Unify warnings about unmovable pods (#389)" (#430)
This reverts commit 4fa09e0dcb.

Reason: the reverted commit bloats the logs
2018-12-21 17:39:34 +01:00
cmd Allow configuring the operator via the YAML manifest. (#326) 2018-07-16 16:20:46 +02:00
docker Fix typo in port (#219) 2018-02-02 15:51:26 +01:00
docs Add shm_volume option (#427) 2018-12-21 16:22:30 +01:00
hack Use code-generation for CRD API and deepcopy methods (#369) 2018-08-15 17:22:25 +02:00
manifests Add shm_volume option (#427) 2018-12-21 16:22:30 +01:00
pkg Revert "Unify warnings about unmovable pods (#389)" (#430) 2018-12-21 17:39:34 +01:00
.gitignore Initial implementation for the statefulset annotations indicating rolling updates. 2018-05-07 08:07:37 +02:00
.golangci.yml add .golangci.yml (#422) 2018-11-27 12:00:15 +01:00
.travis.yml Update travis configuration. (#332) 2018-06-27 12:30:24 +02:00
.zappr.yaml Restore .zappr.yaml (#405) 2018-11-07 13:06:53 +01:00
CODEOWNERS Update CODEOWNERS (#376) 2018-08-29 14:00:00 +02:00
CONTRIBUTING.md Change the broken reference. 2017-05-12 14:56:22 +02:00
LICENSE Move license to the root folder. 2017-05-12 16:16:07 +02:00
MAINTAINERS [WIP] Draft codeowners, update maintainers (#358) 2018-08-06 08:59:00 +02:00
Makefile Minor improvements (#381) 2018-11-06 11:08:13 +01:00
README.md Add golangci badge (#423) 2018-11-27 11:59:59 +01:00
SECURITY.md docs(general): Adding Security.md (#88) 2017-09-04 14:33:30 +02:00
build-ci.sh Use zalando incubator instead of an old repo 2017-05-12 14:57:58 +02:00
delivery.yaml [WIP] Add set_memory_request_to_limit option (#406) 2018-11-15 14:00:08 +01:00
glide.lock Fix the casing of github.com/Sirupsen/logrus to match what the project itself uses. (#380) 2018-09-06 10:26:48 +02:00
glide.yaml Fix the casing of github.com/Sirupsen/logrus to match what the project itself uses. (#380) 2018-09-06 10:26:48 +02:00
mkdocs.yml Docs/reference (#323) 2018-06-12 19:12:11 +02:00
run_operator_locally.sh Revert "Unify warnings about unmovable pods (#389)" (#430) 2018-12-21 17:39:34 +01:00

README.md

Postgres Operator

Build Status Coverage Status Go Report Card GoDoc golangci

Introduction

The Postgres operator manages PostgreSQL clusters on Kubernetes:

  1. The operator watches additions, updates, and deletions of PostgreSQL cluster manifests and changes the running clusters accordingly. For example, when a user submits a new manifest, the operator fetches that manifest and spawns a new Postgres cluster along with all necessary entities such as Kubernetes StatefulSets and Postgres roles. See this Postgres cluster manifest for settings that a manifest may contain.

  2. The operator also watches updates to its own configuration and alters running Postgres clusters if necessary. For instance, if a pod docker image is changed, the operator carries out the rolling update. That is, the operator re-spawns one-by-one pods of each StatefulSet it manages with the new Docker image.

  3. Finally, the operator periodically synchronizes the actual state of each Postgres cluster with the desired state defined in the cluster's manifest.

There is a browser-friendly version of this documentation at postgres-operator.readthedocs.io

Table of contents

the rest of the document is a tutorial to get you up and running with the operator on Minikube.

Quickstart

Prerequisites:

Note that you can also use built-in Kubernetes support in the Docker Desktop for Mac to follow the steps of this tutorial. You would have to replace minikube start and minikube delete with your launch actionsfor the Docker built-in Kubernetes support.

Local execution

git clone https://github.com/zalando-incubator/postgres-operator.git
cd postgres-operator

minikube start

# start the operator; may take a few seconds
kubectl create -f manifests/configmap.yaml  # configuration
kubectl create -f manifests/operator-service-account-rbac.yaml  # identity and permissions
kubectl create -f manifests/postgres-operator.yaml  # deployment

# create a Postgres cluster in a non-default namespace
kubectl create namespace test
kubectl config set-context minikube --namespace=test
kubectl create -f manifests/minimal-postgres-manifest.yaml

# connect to the Postgres master via psql
# operator creates the relevant k8s secret
export HOST_PORT=$(minikube service --namespace test acid-minimal-cluster --url | sed 's,.*/,,')
export PGHOST=$(echo $HOST_PORT | cut -d: -f 1)
export PGPORT=$(echo $HOST_PORT | cut -d: -f 2)
export PGPASSWORD=$(kubectl get secret postgres.acid-minimal-cluster.credentials -o 'jsonpath={.data.password}' | base64 -d)
psql -U postgres

# tear down cleanly
minikube delete

We have automated starting the operator and submitting the acid-minimal-cluster for you:

cd postgres-operator
./run_operator_locally.sh

Note we provide the /manifests directory as an example only; you should consider adjusting the manifests to your particular setting.

Running and testing the operator

The best way to test the operator is to run it locally in minikube. See developer docs(docs/developer.yaml) for details.

Configuration Options

The operator can be configured with the provided ConfigMap(manifests/configmap.yaml) or the operator's own CRD.