|
| 1 | +[[id_of_hyla_picture]] |
| 2 | +image::docs/crunchy_logo.png[Hyla Arborea,width="40%",height="40%", align="center"] |
1 | 3 | = PostgreSQL Operator |
2 | | -:toc: |
3 | | -v2.6, {docdate} |
4 | | - |
5 | | -== Overview |
6 | 4 |
|
7 | | -The PostgreSQL Operator provides a Kubernetes operator capability for managing PostgreSQL Clusters deployed within a Kubernetes environment. The project |
8 | | -also incorporates a REST API and REST client for interfacing with the |
9 | | -Operator. |
10 | | - |
11 | | -image::docs/tty.gif?raw=true[] |
| 5 | +v2.6, {docdate} |
12 | 6 |
|
13 | | -The PostgreSQL Operator leverages Kubernetes Custom Resource Definitions to define custom resource types such as: |
| 7 | +The *postgres-operator* is a controller that runs within a Kubernetes cluster that provides a means to deploy and manage PostgreSQL clusters. |
14 | 8 |
|
15 | | - * *pgcluster* |
16 | | - * *pgreplica* |
17 | | - * *pgbackups* |
18 | | - * *pgpolicies* |
| 9 | +Use the *postgres-operator* to: |
19 | 10 |
|
20 | | -Kubernetes provides the ability to create and manage Custom Resource Definitions similar to any other native Kubernetes object. |
| 11 | + * deploy PostgreSQL containers including streaming replication clusters |
| 12 | + * scale up PostgreSQL clusters with extra replicas |
| 13 | + * add pgpool and metrics sidecars to PostgreSQL clusters |
| 14 | + * apply SQL policies to PostgreSQL clusters |
| 15 | + * assign metadata tags to PostgreSQL clusters |
| 16 | + * maintain PostgreSQL users and passwords |
| 17 | + * perform minor and major upgrades to PostgreSQL clusters |
| 18 | + * load simple CSV and JSON files into PostgreSQL clusters |
| 19 | + * perform database backups |
21 | 20 |
|
22 | | -The PostgreSQL Operator runs within Kubernetes detecting these custom object types as they are created, updated, or removed. |
| 21 | +== Design |
23 | 22 |
|
24 | | -The PostgreSQL Operator enables users to perform operations, including: |
| 23 | +The *postgres-operator* design incorporates the following concepts: |
25 | 24 |
|
26 | | -* Create, Delete, Scale, Restore, and Backup a PostgreSQL Cluster |
27 | | -* Upgrade a PostgreSQL Cluster |
28 | | -* View PVCs used by PostgreSQL clusters |
29 | | -* Test Connections to a PostgreSQL Cluster |
30 | | -* Create and apply a SQL-based Policy to a PostgreSQL Cluster |
31 | | -* Perform User and Password Management |
32 | | -* Apply User Defined Labels to PostgreSQL Clusters |
| 25 | + * adds Custom Resource Definitions for PostgreSQL to Kubernetes |
| 26 | + * adds controller logic that watches events on PostgreSQL resources |
| 27 | + * provides a command line client (*pgo*) and REST API for interfacing with the postgres-operator |
| 28 | + * provides for very customized deployments including container resources, storage configurations, and PostgreSQL custom configurations |
33 | 29 |
|
| 30 | +More design information is found on the link:docs/design.asciidoc[Design] page. |
34 | 31 |
|
35 | | -[#Requirements] |
36 | 32 | == Requirements |
37 | 33 |
|
38 | | -CRD (custom resource definitions) are supported starting with Kube 1.7.X and |
39 | | -with the PostgreSQL Operator version 2.0. |
| 34 | +The *postgres-operator* runs on Kubernetes and Openshift platforms that support |
| 35 | +CRD (custom resource definitions). |
40 | 36 |
|
41 | | -If you require an older version of Kube (< 1.7), you can work |
42 | | -with the PostgreSQL Operator version 1.5.2 which resides in the github 1.5.X branch. |
43 | | -Note however, that the older operator will be deprecated and no longer |
44 | | -maintained in the future. |
| 37 | +== Quickstart |
45 | 38 |
|
46 | | -The CRD version of the operator is tested on the following platforms: |
| 39 | +Quickstart scripts are provided for GKE and Openshift currently. More information is found on the link:docs/quickstarts.asciidoc[Quickstarts] page. |
47 | 40 |
|
48 | | -* *Kubernetes 1.7.X+* |
49 | | -* *Kubernetes 1.8.0+* |
50 | | -* *Openshift Container Platform 3.7* |
| 41 | +== Installation |
51 | 42 |
|
52 | | -This Operator has also been tested on the following operating systems: |
| 43 | +To build and deploy the Operator on your Kubernetes system, follow the instructions documented on the link:docs/install.asciidoc[Installation] page. |
53 | 44 |
|
54 | | -* *CentOS 7.3+* |
55 | | -* *RHEL 7.3+* |
56 | | - |
57 | | -[#Build and Install Instructions] |
58 | | -== Build and Install Instructions |
59 | | - |
60 | | -To build and deploy the Operator on your Kubernetes system, follow |
61 | | -the instructions documented on the link:docs/operator-docs.asciidoc[Build and Install] page. |
| 45 | +== Configuration |
62 | 46 |
|
63 | | -With the operator deployed, the *pgo* command line |
64 | | -interface can execute commands that the *postgres-operator* understands |
65 | | -and reacts to. |
| 47 | +The operator is template-driven; this makes it simple to configure both the client and the operator. The configuration options are documented on the link:docs/configuration.asciidoc[Configuration] page. |
66 | 48 |
|
67 | | -[#Configuration] |
68 | | -== Configuration |
| 49 | +== Commands |
69 | 50 |
|
70 | | -The operator is template-driven; this makes it simple to configure both the client and the operator. The |
71 | | -configuration options are documented on the link:docs/operator-docs.asciidoc[Configuration] page. |
72 | | - |
73 | | -[#Examples] |
74 | | -== Examples |
75 | | - |
76 | | -Some examples of using the *pgo* command line interface are as follows. |
77 | | - |
78 | | -.Display Cluster Information |
79 | | -[source,bash] |
80 | | ----- |
81 | | -pgo show cluster all |
82 | | -pgo show cluster db1 db2 db3 |
83 | | -pgo show cluster mycluster |
84 | | -pgo show cluster mycluster --show-secrets=true |
85 | | ----- |
86 | | - |
87 | | -.Create Cluster |
88 | | -[source,bash] |
89 | | ----- |
90 | | -pgo create cluster mycluster |
91 | | ----- |
92 | | - |
93 | | -.Scale Cluster |
94 | | -[source,bash] |
95 | | ----- |
96 | | -pgo scale mycluster --replica-count=2 |
97 | | ----- |
98 | | - |
99 | | -.Delete a Cluster |
100 | | -[source,bash] |
101 | | ----- |
102 | | -pgo delete cluster mycluster |
103 | | ----- |
104 | | - |
105 | | -.Backup Cluster |
106 | | -[source,bash] |
107 | | ----- |
108 | | -pgo create backup mycluster |
109 | | ----- |
110 | | - |
111 | | -.Restore Cluster |
112 | | -[source,bash] |
113 | | ----- |
114 | | -pgo create cluster myrestore --secret-from=foo --backup-pvc=mypvc --backup-path=foo-backups/2017-03-21-15-57-21 |
115 | | ----- |
116 | | - |
117 | | -.Upgrade Cluster (minor Postgres version upgrade) |
118 | | -[source,bash] |
119 | | ----- |
120 | | -pgo create upgrade mycluster |
121 | | ----- |
122 | | - |
123 | | -.Upgrade Cluster (major Postgres version upgrade from 9.5 to 9.6) |
124 | | -[source,bash] |
125 | | ----- |
126 | | -pgo create upgrade mycluster --upgrade-type=major |
127 | | ----- |
128 | | - |
129 | | -.View PVC |
130 | | -[source,bash] |
131 | | ----- |
132 | | -pgo show pvc mypvc |
133 | | ----- |
134 | | - |
135 | | -.Test Connections |
136 | | -[source,bash] |
137 | | ----- |
138 | | -pgo test mycluster |
139 | | ----- |
140 | | - |
141 | | -.Create a Policy |
142 | | -[source,bash] |
143 | | ----- |
144 | | -pgo create policy policy1 --in-file=./policy1.sql |
145 | | -pgo create policy policy1 --url=https://someurl/policy1.sql |
146 | | ----- |
147 | | - |
148 | | -.Apply a Policy |
149 | | -WARNING: policies are POWERFUL because they are executed as the superuser in PostgreSQL |
150 | | -which allows for any sort of SQL to be executed. |
151 | | -[source,bash] |
152 | | ----- |
153 | | -pgo apply policy1 --selector=name=mycluster |
154 | | ----- |
155 | | - |
156 | | -Details on the *pgo* commands and complex examples are found in the |
157 | | -link:docs/operator-docs.asciidoc[User Guide] |
158 | | - |
159 | | -== PostgreSQL Operator Container |
160 | | - |
161 | | -The following diagram depicts the components of the PostgreSQL Operator, |
162 | | -here the PostgreSQL operator client, *pgo*, is |
163 | | -shown interacting with the PostgreSQL operator that runs within |
164 | | -a Kubernetes cluster. The operator is responsible for creating |
165 | | -or modifying PostgreSQL databases deployed within the Kubernetes cluster. |
166 | | - |
167 | | -image::docs/operator-diagram.png?raw=true[] |
168 | | - |
169 | | -The *pgo* client is a REST client which interacts |
170 | | -with the *apiserver*. The *apiserver* is a REST API that interacts |
171 | | -with the Kube API including creating Custom Resource Definition resources |
172 | | -implemented by the PostgreSQL Operator. |
173 | | - |
174 | | -The operator functionality runs in a Kubernetes Deployment on your |
175 | | -Kubernetes cluster. |
176 | | - |
177 | | -The *postgres-operator* Docker container image is available on link:https://hub.docker.com/r/crunchydata/postgres-operator/[Dockerhub]. |
178 | | -The *postgres-operator-apiserver* Docker container image is available on link:https://hub.docker.com/r/crunchydata/apiserver/[Dockerhub]. |
179 | | -The *pgo* client is available on in the Releases section of |
180 | | -this github repo site. |
181 | | - |
182 | | -What actually gets created on the Kubernetes cluster for a |
183 | | -*pgcluster* resource is defined as a *deployment strategy*. Strategies |
184 | | -are documented in detail in link:docs/design.asciidoc#postgresql-operator-deployment-strategies[Deployment Strategies]. |
185 | | - |
186 | | -You can also build the project Docker images using |
187 | | -the build instructions located on the link:docs/operator-docs.asciidoc[Build and Setup] page. |
| 51 | +*postgres-operator* commands are documented on the link:docs/commands.asciidoc[Commands] page. |
0 commit comments