Skip to content

Commit 70e9e56

Browse files
author
Jonathan S. Katz
committed
Update the Quickstart
Now includes a "very, VERY quickstart" but drives people to use the container-based installer.
1 parent 95360ea commit 70e9e56

File tree

3 files changed

+59
-132
lines changed

3 files changed

+59
-132
lines changed

docs/content/installation/postgres-operator.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ If you believe that all the default settings in the installation manifest work
1313
for you, you can take a chance by running the manifest directly from the
1414
repository:
1515

16-
```shell
16+
```
17+
kubectl create namespace pgo
1718
kubectl apply -f https://raw.githubusercontent.com/CrunchyData/postgres-operator/master/installers/kubectl/postgres-operator.yml
1819
```
1920

@@ -66,6 +67,12 @@ By default, the installer will run in the `pgo` Namespace. This can be
6667
updated in the `postgres-operator.yml` file. **Please ensure that this namespace
6768
exists before the job is run**.
6869

70+
For example, to create the `pgo` namespace:
71+
72+
```
73+
kubectl create namespace pgo
74+
```
75+
6976
The PostgreSQL Operator has the ability to manage PostgreSQL clusters across
7077
multiple Kubernetes [Namespaces](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/),
7178
including the ability to add and remove Namespaces that it watches. Doing so
@@ -117,7 +124,7 @@ The deploy job can be used to perform different deployment actions for the
117124
PostgreSQL Operator. When you run the job it will install the operator by
118125
default but you can change the deployment action to uninstall or update. The
119126
`DEPLOY_ACTION` environment variable in the `postgres-operator.yml` file can be
120-
set to `install`, `update`, and `uninstall`.
127+
set to `install`, `update`, and `uninstall`.
121128

122129

123130
### Image Pull Secrets

docs/content/quickstart/_index.md

Lines changed: 49 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -11,200 +11,120 @@ Can't wait to try out the PostgreSQL Operator? Let us show you the quickest poss
1111

1212
There are two paths to quickly get you up and running with the PostgreSQL Operator:
1313

14-
- [Installation via Ansible](#ansible)
14+
- [Installation via the PostgreSQL Operator Installer](#postgresql-operator-installer)
1515
- Installation via a Marketplace
1616
- Installation via [Google Cloud Platform Marketplace](#google-cloud-platform-marketplace)
1717

1818
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.
1919

20-
# Ansible
20+
# PostgreSQL Operator Installer
2121

2222
Below will guide you through the steps for installing and using the PostgreSQL Operator using an installer that works with Ansible.
2323

24-
## Step 1: Prerequisites
24+
## The Very, VERY Quickstart
2525

26-
### Kubernetes / OpenShift
26+
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:
2727

28-
- A Kubernetes or OpenShift environment where you have enough privileges to install an application, i.e. you can add a [ClusterRole](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole). If you're a Cluster Admin, you're all set.
29-
- Your Kubernetes version should be 1.13+. **NOTE**: For v4.3.0, while we have updated the PostgreSQL Operator for compatibility with 1.16+, we have not fully tested it.
30-
- For OpenShift, the PostgreSQL Operator will work in 3.11+
31-
- [PersistentVolume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)s that are available
32-
33-
### Your Environment
34-
35-
- [`kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/) or [`oc`](https://www.okd.io/download.html). Ensure you can access your Kubernetes or OpenShift cluster (this is outside the scope of this document)
36-
- [`ansible`](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) 2.8.0+. Learn how to [download ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)
37-
- `git`
38-
- If you are installing to Google Kubernetes Engine, you will need the [`gcloud`](https://cloud.google.com/sdk/install) utility
39-
40-
## Step 2: Configuration
41-
42-
### Get the PostgreSQL Operator Ansible Installation Playbook
43-
44-
You can download the playbook by cloning the [PostgreSQL Operator git repository](https://github.com/CrunchyData/postgres-operator) and running the following commands:
45-
46-
```shell
47-
git clone https://github.com/CrunchyData/postgres-operator.git
48-
cd postgres-operator
49-
git checkout v4.3.0 # you can substitute this for the version that you want to install
50-
cd ansible
28+
```
29+
kubectl create namespace pgo
30+
kubectl apply -f https://raw.githubusercontent.com/CrunchyData/postgres-operator/master/installers/kubectl/postgres-operator.yml
5131
```
5232

53-
### Configure your Installation
54-
55-
Within the `ansible` folder, there exists a file called `inventory`. When you open up this file, you can see several options that are used to install the PostgreSQL Operator. Most of these contain some sensible defaults for getting up and running quickly, but some you will need to fill out yourself.
56-
57-
Lines that start with a `#` are commented out. To activate that configuration setting, you will have to delete the `#`.
33+
If not, please read onward: you can still get up and running fairly quickly with just a little bit of configuration.
5834

59-
Set up your `inventory` file based on one of the environments that you are deploying to:
35+
## Step 1: Configuration
6036

61-
#### Kubernetes
37+
### Get the PostgreSQL Operator Installer Manifest
6238

63-
You will have to uncomment and set the `kubernetes_context` variable. This can be determined based on the output of the `kubectl config current-context` e.g.:
39+
You will need to download the PostgreSQL Operator Installer manifest to your environment, which you can do with the following command:
6440

65-
```shell
66-
kubectl config current-context
67-
kubernetes-admin@kubernetes
6841
```
69-
70-
Note that the output will vary based on the Kubernetes cluster you are using.
71-
72-
Using the above example, set the value of `kubernetes_context` to the output of the `kubectl config current-context` command, e.g.
73-
74-
```python
75-
kubernetes_context="kubernetes-admin@kubernetes"
42+
curl https://raw.githubusercontent.com/CrunchyData/postgres-operator/master/installers/kubectl/postgres-operator.yml > postgres-operator.yml
7643
```
7744

78-
Find the location of the `pgo_admin_password` configuration variable. Set this to a password of your choosing, e.g.
45+
If you wish to download a specific version of the installer, you can substitute `master` with the version of the tag, i.e.
7946

80-
```python
81-
pgo_admin_password="hippo-elephant"
8247
```
83-
84-
Finally, you will need to set the storage default storage classes that you would like the Operator to use. For example, if your Kubernetes environment is using NFS storage, you would set this variables to the following:
85-
86-
```python
87-
backrest_storage='nfsstorage'
88-
backup_storage='nfsstorage'
89-
primary_storage='nfsstorage'
90-
replica_storage='nfsstorage'
48+
curl https://raw.githubusercontent.com/CrunchyData/postgres-operator/v4.3.0/installers/kubectl/postgres-operator.yml > postgres-operator.yml
9149
```
9250

93-
For a full list of available storage types that can be used with this installation method, see: $URL
94-
95-
#### OpenShift
96-
97-
For an OpenShfit deployment, you will at a minimum have to to uncomment and set the `openshift_host` variable. This is the location of where your OpenShift environment is, and can be obtained from your administrator. For example:
98-
99-
```python
100-
openshift_host="https://openshift.example.com:6443"
101-
```
51+
### Configure the PostgreSQL Operator Installer
10252

103-
Based on how your OpenShift environment is configured, you may need to set the following variables:
53+
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.
10454

105-
- `openshift_user`
106-
- `openshift_password`
107-
- `openshift_token`
55+
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`.
10856

109-
An optional `openshift_skip_tls_verify=true` variable is available if your OpenShift environment allows you to skip TLS verification.
57+
You will need 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]_TYPE`. Find the one that you want to use, and set it to that value.
11058

111-
Next, find the location of the `pgo_admin_password` configuration variable. Set this to a password of your choosing, e.g.
59+
For example, if your Kubernetes environment is using NFS storage, you would set these variables to the following:
11260

113-
```python
114-
pgo_admin_password="hippo-elephant"
11561
```
116-
117-
Finally, you will need to set the storage default storage classes that you would like the Operator to use. For example, if your OpenShift environment is using Rook storage, you would set this variables to the following:
118-
119-
```python
120-
backrest_storage='rook'
121-
backup_storage='rook'
122-
primary_storage='rook'
123-
replica_storage='rook'
62+
- name: BACKREST_STORAGE
63+
value: "nfsstorage"
64+
- name: BACKUP_STORAGE
65+
value: "nfsstorage"
66+
- name: PRIMARY_STORAGE
67+
value: "nfsstorage"
68+
- name: REPLICA_STORAGE
69+
value: "nfsstorage"
12470
```
12571

126-
For a full list of available storage types that can be used with this installation method, see: $URL
72+
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">}}).
12773

128-
#### Google Kubernetes Engine (GKE)
74+
## Step 2: Installation
12975

130-
For deploying the PostgreSQL Operator to GKE, you will need to set up your cluster similar to the Kubernetes set up. First, you will need to get the value for the `kubernetes_context` variable. Using the `gcloud` utility, ensure you are logged into the GCP Project that you are installing the PostgreSQL Operator into:
76+
Installation is as easy as executing:
13177

132-
```shell
133-
gcloud config set project [PROJECT_ID]
13478
```
135-
136-
You can read about how you can [get the value of `[PROJECT_ID]`](https://cloud.google.com/resource-manager/docs/creating-managing-projects?visit_id=637125463737632776-3096453244&rd=1#identifying_projects)
137-
138-
From here, you can get the value that needs to be set into the `kubernetes_context`.
139-
140-
You will have to uncomment and set the `kubernetes_context` variable. This can be determined based on the output of the `kubectl config current-context` e.g.:
141-
142-
```shell
143-
kubectl config current-context
144-
gke_some-name_some-zone-some_project
79+
kubectl create namespace pgo
80+
kubectl apply -f postgres-operator.yml
14581
```
14682

147-
Note that the output will vary based on your GKE project.
83+
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.
14884

149-
Using the above example, set the value of `kubernetes_context` to the output of the `kubectl config current-context` command, e.g.
85+
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:
15086

151-
```python
152-
kubernetes_context="gke_some-name_some-zone-some_project"
15387
```
154-
155-
Next, find the location of the `pgo_admin_password` configuration variable. Set this to a password of your choosing, e.g.
156-
157-
```python
158-
pgo_admin_password="hippo-elephant"
88+
curl https://raw.githubusercontent.com/CrunchyData/postgres-operator/v4.3.0/installers/kubectl/client-setup.sh > client-setup.sh
89+
chmod +x client-setup.sh
15990
```
16091

161-
Finally, you will need to set the storage default storage classes that you would like the Operator to use. For deploying to GKE it is recommended to use the `gce` storag class:
92+
When the PostgreSQL Operator is done installing, run the client setup script:
16293

163-
```python
164-
backrest_storage='gce'
165-
backup_storage='gce'
166-
primary_storage='gce'
167-
replica_storage='gce'
16894
```
169-
## Step 3: Installation
170-
171-
Ensure you are still in the `ansible` directory and run the following command to install the PostgreSQL Operator:
172-
173-
```shell
174-
ansible-playbook -i inventory --tags=install main.yml
95+
./client-setup.sh
17596
```
17697

177-
This can take a few minutes to complete depending on your Kubernetes cluster.
98+
This will download the `pgo` client and provide instructions for how to easily use it in your environment. It will prompt you to add some environmental variables for you to set up in your session, which you can do with the following commands:
17899

179-
While the PostgreSQL Operator is installing, for ease of using the `pgo` command line interface, you will need to set up some environmental variables. You can do so with the following command:
180100

181-
```shell
101+
```
182102
export PGOUSER="${HOME?}/.pgo/pgo/pgouser"
183103
export PGO_CA_CERT="${HOME?}/.pgo/pgo/client.crt"
184104
export PGO_CLIENT_CERT="${HOME?}/.pgo/pgo/client.crt"
185105
export PGO_CLIENT_KEY="${HOME?}/.pgo/pgo/client.pem"
186106
export PGO_APISERVER_URL='https://127.0.0.1:8443'
187-
export PGO_NAMESPACE=pgouser1
107+
export PGO_NAMESPACE=pgo
188108
```
189109

190110
If you wish to permanently add these variables to your environment, you can run the following:
191111

192-
```shell
112+
```
193113
cat <<EOF >> ~/.bashrc
194114
export PGOUSER="${HOME?}/.pgo/pgo/pgouser"
195115
export PGO_CA_CERT="${HOME?}/.pgo/pgo/client.crt"
196116
export PGO_CLIENT_CERT="${HOME?}/.pgo/pgo/client.crt"
197117
export PGO_CLIENT_KEY="${HOME?}/.pgo/pgo/client.pem"
198118
export PGO_APISERVER_URL='https://127.0.0.1:8443'
199-
export PGO_NAMESPACE=pgouser1
119+
export PGO_NAMESPACE=pgo
200120
EOF
201121
202122
source ~/.bashrc
203123
```
204124

205125
**NOTE**: For macOS users, you must use `~/.bash_profile` instead of `~/.bashrc`
206126

207-
## Step 4: Verification
127+
## Step 3: Verification
208128

209129
Below are a few steps to check if the PostgreSQL Operator is up and running.
210130

@@ -255,12 +175,12 @@ pgo client version 4.3.0
255175
pgo-apiserver version 4.3.0
256176
```
257177

258-
## Step 5: Have Some Fun - Create a PostgreSQL Cluster
178+
## Step 4: Have Some Fun - Create a PostgreSQL Cluster
259179

260-
The quickstart installation method creates two namespaces that you can deploy your PostgreSQL clusters into called `pgouser1` and `pgouser2`. Let's create a new PostgreSQL cluster in `pgouser1`:
180+
The quickstart installation method creates a namespace called `pgo` where the PostgreSQL Operator manages PostgreSQL clusters. Try creating a PostgreSQL cluster called `hippo`:
261181

262182
```shell
263-
pgo create cluster -n pgouser1 hippo
183+
pgo create cluster -n pgo hippo
264184
```
265185

266186
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:
@@ -281,7 +201,7 @@ workflow id 1cd0d225-7cd4-4044-b269-aa7bedae219b
281201
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:
282202

283203
```shell
284-
pgo test -n pgouser1 hippo
204+
pgo test -n pgo hippo
285205
```
286206

287207
When everything is up and running, you should see output similar to this:
@@ -294,7 +214,7 @@ cluster : hippo
294214
primary (hippo-7b64747476-6dr4h): UP
295215
```
296216

297-
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 pgouser1 hippo`.
217+
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`.
298218

299219
# Marketplaces
300220

operator/cluster/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ func recreateBackrestRepoSecret(clientset *kubernetes.Clientset, clustername, na
459459
ClusterNamespace: namespace,
460460
OperatorNamespace: operatorNamespace,
461461
}); err != nil {
462-
log.Errorf("error generating new backrest repo secrets during pgcluster ugprade: %v", err)
462+
log.Errorf("error generating new backrest repo secrets during pgcluster upgrade: %v", err)
463463
}
464464
}
465465

0 commit comments

Comments
 (0)