Skip to content

Commit afb45f2

Browse files
committed
Move marketplace details out of quickstart
1 parent f9d6bb4 commit afb45f2

File tree

4 files changed

+200
-199
lines changed

4 files changed

+200
-199
lines changed

docs/content/installation/other/bash.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Bash Scripts"
33
date:
44
draft: false
5-
weight: 200
5+
weight: 100
66
---
77

88
A full installation of the Operator includes the following steps:
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
---
2+
title: "Google Cloud Marketplace"
3+
date:
4+
draft: false
5+
weight: 200
6+
---
7+
8+
The PostgreSQL Operator is installed as part of [Crunchy PostgreSQL for GKE][gcm-listing]
9+
that is available in the Google Cloud Marketplace.
10+
11+
[gcm-listing]: https://console.cloud.google.com/marketplace/details/crunchydata/crunchy-postgresql-operator
12+
13+
14+
## Step 1: Install
15+
16+
Install [Crunchy PostgreSQL for GKE][gcm-listing] to a Google Kubernetes Engine cluster using
17+
Google Cloud Marketplace.
18+
19+
20+
## Step 2: Verify Installation
21+
22+
Install `kubectl` using the `gcloud components` command of the [Google Cloud SDK][sdk-install] or
23+
by following the [Kubernetes documentation][kubectl-install].
24+
25+
[kubectl-install]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
26+
[sdk-install]: https://cloud.google.com/sdk/docs/install
27+
28+
Using the `gcloud` utility, ensure you are logged into the GKE cluster in which you installed the
29+
PostgreSQL Operator, and see that it is running in the namespace in which you installed it.
30+
For example, in the `pgo` namespace:
31+
32+
```shell
33+
kubectl -n pgo get deployments,pods
34+
```
35+
36+
If successful, you should see output similar to this:
37+
38+
```
39+
NAME READY UP-TO-DATE AVAILABLE AGE
40+
deployment.apps/postgres-operator 1/1 1 1 16h
41+
42+
NAME READY STATUS RESTARTS AGE
43+
pod/postgres-operator-56d6ccb97-tmz7m 4/4 Running 0 2m
44+
```
45+
46+
47+
## Step 3: Install the PostgreSQL Operator User Keys
48+
49+
You will need to get TLS keys used to secure the Operator REST API. Again, in the `pgo` namespace:
50+
51+
```shell
52+
kubectl -n pgo get secret pgo.tls -o 'go-template={{ index .data "tls.crt" | base64decode }}' > /tmp/client.crt
53+
kubectl -n pgo get secret pgo.tls -o 'go-template={{ index .data "tls.key" | base64decode }}' > /tmp/client.key
54+
```
55+
56+
57+
## Step 4: Setup PostgreSQL Operator User
58+
59+
The PostgreSQL Operator implements its own role-based access control (RBAC) system for authenticating and authorization PostgreSQL Operator users access to its REST API. A default PostgreSQL Operator user (aka a "pgouser") is created as part of the marketplace installation (these credentials are set during the marketplace deployment workflow).
60+
61+
Create the pgouser file in `${HOME?}/.pgo/<operatornamespace>/pgouser` and insert the user and password you created on deployment of the PostgreSQL Operator via GCP Marketplace. For example, if you set up a user with the username of `username` and a password of `hippo`:
62+
63+
```shell
64+
username:hippo
65+
```
66+
67+
68+
## Step 5: Setup Environment variables
69+
70+
The PostgreSQL Operator Client uses several environmental variables to make it easier for interfacing with the PostgreSQL Operator.
71+
72+
Set the environmental variables to use the key / certificate pair that you pulled in Step 3 was deployed via the marketplace. Using the previous examples, You can set up environment variables with the following command:
73+
74+
```shell
75+
export PGOUSER="${HOME?}/.pgo/pgo/pgouser"
76+
export PGO_CA_CERT="/tmp/client.crt"
77+
export PGO_CLIENT_CERT="/tmp/client.crt"
78+
export PGO_CLIENT_KEY="/tmp/client.key"
79+
export PGO_APISERVER_URL='https://127.0.0.1:8443'
80+
export PGO_NAMESPACE=pgo
81+
```
82+
83+
If you wish to permanently add these variables to your environment, you can run the following command:
84+
85+
```shell
86+
cat <<EOF >> ~/.bashrc
87+
export PGOUSER="${HOME?}/.pgo/pgo/pgouser"
88+
export PGO_CA_CERT="/tmp/client.crt"
89+
export PGO_CLIENT_CERT="/tmp/client.crt"
90+
export PGO_CLIENT_KEY="/tmp/client.key"
91+
export PGO_APISERVER_URL='https://127.0.0.1:8443'
92+
export PGO_NAMESPACE=pgo
93+
EOF
94+
95+
source ~/.bashrc
96+
```
97+
98+
**NOTE**: For macOS users, you must use `~/.bash_profile` instead of `~/.bashrc`
99+
100+
101+
## Step 6: Install the PostgreSQL Operator Client `pgo`
102+
103+
The [`pgo` client](/pgo-client/) provides a helpful command-line interface to perform key operations on a PostgreSQL Operator, such as creating a PostgreSQL cluster.
104+
105+
The `pgo` client can be downloaded from GitHub [Releases](https://github.com/crunchydata/postgres-operator/releases) (subscribers can download it from the [Crunchy Data Customer Portal](https://access.crunchydata.com)).
106+
107+
Note that the `pgo` client's version must match the version of the PostgreSQL Operator that you have deployed. For example, if you have deployed version {{< param operatorVersion >}} of the PostgreSQL Operator, you must use the `pgo` for {{< param operatorVersion >}}.
108+
109+
Once you have download the `pgo` client, change the permissions on the file to be executable if need be as shown below:
110+
111+
```shell
112+
chmod +x pgo
113+
```
114+
115+
## Step 7: Connect to the PostgreSQL Operator
116+
117+
Finally, let's see if we can connect to the PostgreSQL Operator from the `pgo` client. In order to communicate with the PostgreSQL Operator API server, you will first need to set up a [port forward](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/) to your local environment.
118+
119+
In a new console window, run the following command to set up a port forward:
120+
121+
```shell
122+
kubectl -n pgo port-forward svc/postgres-operator 8443:8443
123+
```
124+
125+
Back to your original console window, you can verify that you can connect to the PostgreSQL Operator using the following command:
126+
127+
```shell
128+
pgo version
129+
```
130+
131+
If successful, you should see output similar to this:
132+
133+
```
134+
pgo client version {{< param operatorVersion >}}
135+
pgo-apiserver version {{< param operatorVersion >}}
136+
```
137+
138+
## Step 8: Create a Namespace
139+
140+
We are almost there! You can optionally add a namespace that can be managed by the PostgreSQL Operator to watch and to deploy a PostgreSQL cluster into.
141+
142+
```shell
143+
pgo create namespace wateringhole
144+
```
145+
146+
verify the operator has access to the newly added namespace
147+
148+
```shell
149+
pgo show namespace --all
150+
```
151+
152+
you should see out put similar to this:
153+
154+
```shell
155+
pgo username: admin
156+
namespace useraccess installaccess
157+
application-system accessible no access
158+
default accessible no access
159+
kube-public accessible no access
160+
kube-system accessible no access
161+
pgo accessible no access
162+
wateringhole accessible accessible
163+
```
164+
165+
## Step 9: Have Some Fun - Create a PostgreSQL Cluster
166+
167+
You are now ready to create a new cluster in the `wateringhole` namespace, try the command below:
168+
169+
```shell
170+
pgo create cluster -n wateringhole hippo
171+
```
172+
173+
If successful, you should see output similar to this:
174+
175+
```
176+
created Pgcluster hippo
177+
workflow id 1cd0d225-7cd4-4044-b269-aa7bedae219b
178+
```
179+
180+
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:
181+
182+
```shell
183+
pgo test -n wateringhole hippo
184+
```
185+
186+
When everything is up and running, you should see output similar to this:
187+
188+
```
189+
cluster : hippo
190+
Services
191+
primary (10.97.140.113:5432): UP
192+
Instances
193+
primary (hippo-7b64747476-6dr4h): UP
194+
```
195+
196+
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 wateringhole hippo`.
197+

docs/content/installation/other/helm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Helm Chart"
33
date:
44
draft: false
5-
weight: 200
5+
weight: 100
66
---
77

88
# The PostgreSQL Operator Helm Chart

0 commit comments

Comments
 (0)