You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This reflects the easier installation methodology available (i.e.
that default storage classes do work, and they're glorious), and
expands on some of the other things that people want to get
started, i.e. being able to connect to a database.
@@ -16,72 +16,30 @@ There are two paths to quickly get you up and running with the PostgreSQL Operat
16
16
- Installation via [Operator Lifecycle Manager]({{< relref "/installation/other/operator-hub.md" >}})
17
17
- Installation via [Google Cloud Marketplace]({{< relref "/installation/other/google-cloud-marketplace.md" >}})
18
18
19
-
Marketplaces can help you get more quickly started in your environment as they provide a mostly automated process, but there are a few steps you will need to take to ensure you can fully utilize your PostgreSQL Operator environment.
19
+
Marketplaces can help you get more quickly started in your environment as they provide a mostly automated process, but there are a few steps you will need to take to ensure you can fully utilize your PostgreSQL Operator environment. You can find out more information about how to get started with one of those installers in the [Installation]({{< relref "/installation/_index.md" >}}) section.
20
20
21
21
# PostgreSQL Operator Installer
22
22
23
23
Below will guide you through the steps for installing and using the PostgreSQL Operator using an installer that works with Ansible.
24
24
25
-
## The Very, VERY Quickstart
25
+
## Installation
26
26
27
-
If your environment is set up to use hostpath storage (found in things like [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/) or [OpenShift Code Ready Containers](https://developers.redhat.com/products/codeready-containers/overview), the following command could work for you:
27
+
### Install the PostgreSQL Operator
28
+
29
+
On environments that have a [default storage class](https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/) set up (which is most modern Kubernetes environments), the below command should work:
There are many [configuration parameters]({{< relref "/installation/configuration.md">}}) to help you fine tune your installation, but there are a few that you may want to change to get the PostgreSQL Operator to run in your environment. Open up the `postgres-operator.yml` file and edit a few variables.
55
-
56
-
Find the `pgo_admin_password` variable. This is the password you will use with the [`pgo` client]({{< relref "/installation/pgo-client" >}}) to manage your PostgreSQL clusters. The default is `password`, but you can change it to something like `hippo-elephant`.
57
-
58
-
You will also need to set the storage default storage classes that you would like the PostgreSQL Operator to use. These variables are called `primary_storage`, `replica_storage`, `backup_storage`, and `backrest_storage`. There are several storage configurations listed out in the configuration file under the heading `storage[1-9]_name`. Find the one that you want to use, and set it to that value.
59
-
60
-
For example, if your Kubernetes environment is using NFS storage, you would set these variables to the following:
61
-
62
-
```
63
-
backrest_storage: "nfsstorage"
64
-
backup_storage: "nfsstorage"
65
-
primary_storage: "nfsstorage"
66
-
replica_storage: "nfsstorage"
67
-
```
36
+
This will launch the `pgo-deployer` container that will run the various setup and installation jobs. This can take a few minutes to complete depending on your Kubernetes cluster.
68
37
69
-
If you are using either Openshift or CodeReady Containers, you will need to set `disable_fsgroup` to 'true' in order to deploy the PostgreSQL Operator in OpenShift environments that have the typical restricted Security Context Constraints.
38
+
If your install is unsuccessful, you may need to modify your configuration. Please read the ["Troubleshooting"](#troubleshooting) section. You can still get up and running fairly quickly with just a little bit of configuration.
70
39
71
-
For a full list of available storage types that can be used with this installation method, please review the [configuration parameters]({{< relref "/installation/configuration.md">}}).
40
+
### Install the `pgo` Client
72
41
73
-
## Step 2: Installation
74
-
75
-
Installation is as easy as executing:
76
-
77
-
```
78
-
kubectl create namespace pgo
79
-
kubectl apply -f postgres-operator.yml
80
-
```
81
-
82
-
This will launch the `pgo-deployer` container that will run the various setup and installation jobs. This can take a few minutes to complete depending on your Kubernetes cluster.
83
-
84
-
While the installation is occurring, download the `pgo` client set up script. This will help set up your local environment for using the PostgreSQL Operator:
42
+
During or after the installation of the PostgreSQL Operator, download the `pgo` client set up script. This will help set up your local environment for using the PostgreSQL Operator:
**NOTE**: For macOS users, you must use `~/.bash_profile` instead of `~/.bashrc`
125
83
126
-
##Step 3: Verification
84
+
### Post-Installation Setup
127
85
128
86
Below are a few steps to check if the PostgreSQL Operator is up and running.
129
87
130
-
By default, the PostgreSQL Operator installs into a namespace called `pgo`. First, see that the the Kubernetes Deployment of the Operator exists and is healthy:
88
+
By default, the PostgreSQL Operator installs into a namespace called `pgo`. First, see that the Kubernetes Deployment of the Operator exists and is healthy:
131
89
132
-
```shell
90
+
```
133
91
kubectl -n pgo get deployments
134
92
```
135
93
@@ -142,7 +100,7 @@ postgres-operator 1/1 1 1 16h
142
100
143
101
Next, see if the Pods that run the PostgreSQL Operator are up and running:
144
102
145
-
```shell
103
+
```
146
104
kubectl -n pgo get pods
147
105
```
148
106
@@ -157,13 +115,13 @@ Finally, let's see if we can connect to the PostgreSQL Operator from the `pgo` c
157
115
158
116
In a new console window, run the following command to set up a port forward:
pgo-apiserver version {{< param operatorVersion >}}
175
133
```
176
134
177
-
## Step 4: Have Some Fun - Create a PostgreSQL Cluster
135
+
## Create a PostgreSQL Cluster
178
136
179
137
The quickstart installation method creates a namespace called `pgo` where the PostgreSQL Operator manages PostgreSQL clusters. Try creating a PostgreSQL cluster called `hippo`:
180
138
181
-
```shell
139
+
```
182
140
pgo create cluster -n pgo hippo
183
141
```
184
142
185
-
Alternatively, because we set the [`PGO_NAMESPACE`](/pgo-client/#general-notes-on-using-the-pgo-client) environmental variable in our `.bashrc` file, we could omit the `-n` flag from the [`pgo create cluster`](/pgo-client/reference/pgo_create_cluster/) command and just run this:
143
+
Alternatively, because we set the [`PGO_NAMESPACE`]({{< relref "pgo-client/reference/pgo_create_cluster.md" >}}#general-notes-on-using-the-pgo-client) environmental variable in our `.bashrc` file, we could omit the `-n` flag from the [`pgo create cluster`]({{< relref "pgo-client/reference/pgo_create_cluster.md" >}}) command and just run this:
186
144
187
-
```shell
145
+
```
188
146
pgo create cluster hippo
189
147
```
190
148
@@ -197,9 +155,9 @@ created Pgcluster hippo
197
155
workflow id 1cd0d225-7cd4-4044-b269-aa7bedae219b
198
156
```
199
157
200
-
This will create a PostgreSQL cluster named `hippo`. It may take a few moments for the cluster to be provisioned. You can see the status of this cluster using the `pgo test` command:
158
+
This will create a PostgreSQL cluster named `hippo`. It may take a few moments for the cluster to be provisioned. You can see the status of this cluster using the [`pgo test`]({{< relref "pgo-client/reference/pgo_test.md" >}}) command:
201
159
202
-
```shell
160
+
```
203
161
pgo test -n pgo hippo
204
162
```
205
163
@@ -215,3 +173,166 @@ cluster : hippo
215
173
216
174
The `pgo test` command provides you the basic information you need to connect to your PostgreSQL cluster from within your Kubernetes environment. For more detailed information, you can use `pgo show cluster -n pgo hippo`.
217
175
176
+
## Connect to a PostgreSQL Cluster
177
+
178
+
By default, the PostgreSQL Operator creates a database inside the cluster with the same name of the cluster, in this case, `hippo`. Below demonstrates how we can connect to `hippo`.
179
+
180
+
### How Users Work
181
+
182
+
You can get information about the users in your cluster with the [`pgo show user`]({{< relref "pgo-client/reference/pgo_show_user.md" >}}) command:
183
+
184
+
```
185
+
pgo show user -n pgo hippo
186
+
```
187
+
188
+
This will give you all the unprivileged, non-system PostgreSQL users for the `hippo` PostgreSQL cluster, for example:
The `postgres` user represents the [database superuser](https://www.postgresql.org/docs/current/role-attributes.html) and has every privilege granted to it. The PostgreSQL Operator securely interfaces through the `postgres` account to perform certain actions, such as managing users.
213
+
214
+
The `primaryuser` is the used for replication and [high availability]({{< relref "architecture/high-availability/_index.md" >}}). You should never need to interface with this user account.
215
+
216
+
### Connecting via `psql`
217
+
218
+
Let's see how we can connect to `hippo` using [`psql`](https://www.postgresql.org/docs/current/app-psql.html), the command-line tool for accessing PostgreSQL. Ensure you have [installed the `psql` client](https://www.crunchydata.com/developers/download-postgres/binaries/postgresql12).
219
+
220
+
The PostgreSQL Operator creates a service with the same name as the cluster. See for yourself! Get a list of all of the Services available in the `pgo` namespace:
You should then be greeted with the PostgreSQL prompt:
244
+
245
+
```
246
+
psql (12.4)
247
+
Type "help" for help.
248
+
249
+
hippo=>
250
+
```
251
+
252
+
### Connecting via [pgAdmin 4]({{< relref "architecture/pgadmin4.md" >}})
253
+
254
+
[pgAdmin 4]({{< relref "architecture/pgadmin4.md" >}}) is a graphical tool that can be used to manage and query a PostgreSQL database from a web browser. The PostgreSQL Operator provides a convenient integration with pgAdmin 4 for managing how users can log into the database.
255
+
256
+
To add pgAdmin 4 to `hippo`, you can execute the following command:
257
+
258
+
```
259
+
pgo create pgadmin -n pgo hippo
260
+
```
261
+
262
+
It will take a few moments to create the pgAdmin 4 instance. The PostgreSQL Operator also creates a pgAdmin 4 service. See for yourself! Get a list of all of the Services available in the `pgo` namespace:
Navigate your browser to http://localhost:5050 and use your database username (`testuser`) and password (e.g. `datalake`) to log in. Though the prompt says “email address”, using your PostgreSQL username will work:
(There are occasions where the initial credentials do not properly get set in pgAdmin 4. If you have trouble logging in, try running the command `pgo update user -n pgo hippo --username=testuser --password=datalake`).
285
+
286
+
Once logged into pgAdmin 4, you will be automatically connected to your database. Explore pgAdmin 4 and run some queries!
287
+
288
+
For more information, please see the section on [pgAdmin 4]({{< relref "architecture/pgadmin4.md" >}}).
289
+
290
+
## Troubleshooting
291
+
292
+
### Installation Failures
293
+
294
+
Some Kubernetes environments may require you to customize the configuration for the PostgreSQL Operator installer. The below provides a guide on the common parameters that require modification, though this may vary based on your installation. For a full reference, please visit the [Installation]({{< relref "/installation/_index.md" >}}) section.
295
+
296
+
If you already attempted to install the PostgreSQL Operator and that failed, the easiest way to clean up that installation is to delete the [Namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/) that you attempted to install the PostgreSQL Operator into. **Note: This deletes all of the other objects in the Namespace, so please be sure this is OK!**
297
+
298
+
To delete the namespace, you can run the following command:
299
+
300
+
```
301
+
kubectl delete namespace pgo
302
+
```
303
+
304
+
#### Get the PostgreSQL Operator Installer Manifest
305
+
306
+
You will need to download the PostgreSQL Operator Installer manifest to your environment, which you can do with the following command:
There are many [configuration parameters]({{< relref "/installation/configuration.md">}}) to help you fine tune your installation, but there are a few that you may want to change to get the PostgreSQL Operator to run in your environment. Open up the `postgres-operator.yml` file and edit a few variables.
315
+
316
+
Find the `pgo_admin_password` variable. This is the password you will use with the [`pgo` client]({{< relref "/installation/pgo-client" >}}) to manage your PostgreSQL clusters. The default is `password`, but you can change it to something like `hippo-elephant`.
317
+
318
+
You may also need to set the storage default storage classes that you would like the PostgreSQL Operator to use. These variables are called `primary_storage`, `replica_storage`, `backup_storage`, and `backrest_storage`. There are several storage configurations listed out in the configuration file under the heading `storage[1-9]_name`. Find the one that you want to use, and set it to that value.
319
+
320
+
For example, if your Kubernetes environment is using NFS storage, you would set these variables to the following:
321
+
322
+
```
323
+
backrest_storage: "nfsstorage"
324
+
backup_storage: "nfsstorage"
325
+
primary_storage: "nfsstorage"
326
+
replica_storage: "nfsstorage"
327
+
```
328
+
329
+
If you are using either Openshift or CodeReady Containers and you have a `restricted` Security Context Constraint, you will need to set `disable_fsgroup` to `true` in order to deploy the PostgreSQL Operator.
330
+
331
+
For a full list of available storage types that can be used with this installation method, please review the [configuration parameters]({{< relref "/installation/configuration.md">}}).
332
+
333
+
When you are done editing the file, you can install the PostgreSQL Operator by running the following commands:
0 commit comments