Skip to content

Commit 89f13ef

Browse files
benjaminjbandrewlecuyer
authored andcommitted
update kustomize install docs
1 parent 487756a commit 89f13ef

File tree

1 file changed

+39
-43
lines changed

1 file changed

+39
-43
lines changed

docs/content/installation/kustomize.md

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ weight: 10
99

1010
This section provides instructions for installing and configuring PGO using Kustomize.
1111

12+
If you are deploying using the installer from the [Crunchy Data Customer Portal](https://access.crunchydata.com/), please refer to the guide there for alternative setup information.
13+
1214
## Prerequisites
1315

1416
First, go to GitHub and [fork the Postgres Operator examples](https://github.com/CrunchyData/postgres-operator-examples/fork)
@@ -27,13 +29,14 @@ cd postgres-operator-examples
2729

2830
The PGO installation project is located in the `kustomize/install` directory.
2931

32+
3033
## Configuration
3134

3235
While the default Kustomize install should work in most Kubernetes environments, it may be
3336
necessary to further customize the Kustomize project(s) according to your specific needs.
3437

3538
For instance, to customize the image tags utilized for the PGO Deployment, the `images` setting
36-
in the `kustomize/install/bases/kustomization.yaml` file can be modified:
39+
in the `kustomize/install/default/kustomization.yaml` file can be modified:
3740

3841
```yaml
3942
images:
@@ -46,7 +49,7 @@ If you are deploying using the images from the [Crunchy Data Customer Portal](ht
4649
4750
Please note that the Kustomize install project will also create a namespace for PGO
4851
by default (though it is possible to install without creating the namespace, as shown below). To
49-
modify the name of namespace created by the installer, the `kustomize/install/namespace.yaml`
52+
modify the name of namespace created by the installer, the `kustomize/install/namespace/namespace.yaml`
5053
should be modified:
5154

5255
```yaml
@@ -56,14 +59,14 @@ metadata:
5659
name: custom-namespace
5760
```
5861

59-
The `namespace` setting in `kustomize/install/bases/kustomization.yaml` should be
62+
The `namespace` setting in `kustomize/install/default/kustomization.yaml` should be
6063
modified accordingly.
6164

6265
```yaml
6366
namespace: custom-namespace
6467
```
6568

66-
By default, PGO deploys with debug logging turned on. If you wish to disable this, you need to set the `CRUNCHY_DEBUG` environmental variable to `"false"` that is found in the `kustomize/install/bases/manager/manager.yaml` file. You can add the following to your kustomization to disable debug logging:
69+
By default, PGO deploys with debug logging turned on. If you wish to disable this, you need to set the `CRUNCHY_DEBUG` environmental variable to `"false"` that is found in the `kustomize/install/manager/manager.yaml` file. Alternatively, you can add the following to your `kustomize/install/manager/kustomization.yaml` to disable debug logging:
6770

6871
```yaml
6972
patchesStrategicMerge:
@@ -93,52 +96,41 @@ the permissions it requires to properly manage PostgreSQL clusters across all na
9396
when PGO is configured to manage PostgreSQL clusters within a single namespace only, a Role and
9497
RoleBinding is created instead.
9598

96-
By default, the Kustomize installer will configure PGO to manage PostgreSQL clusters in all
97-
namespaces, which means a ClusterRole and ClusterRoleBinding will also be created by default.
98-
To instead configure PGO to manage PostgreSQL clusters in only a single namespace, simply modify
99-
the `bases` section of the `kustomize/install/bases/kustomization.yaml` file as follows:
100-
101-
```yaml
102-
bases:
103-
- crd
104-
- rbac/namespace
105-
- manager
106-
```
107-
108-
Note that `rbac/cluster` has been changed to `rbac/namespace`.
109-
110-
Add the PGO_TARGET_NAMESPACE environment variable to the env section of the `kustomize/install/bases/manager/manager.yaml` file to facilitate the ability to specify the single namespace as follows:
99+
The installation of the necessary resources for a cluster-wide or a namespace-limited
100+
operator is done automatically by Kustomize, as described below in the Install section.
101+
The only potential change you may need to make is to the Namespace resource and the
102+
`namespace` field if using a namespace other than the default `postgres-operator`.
111103

112-
```yaml
113-
env:
114-
- name: PGO_TARGET_NAMESPACE
115-
valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } }
116-
```
104+
## Install
117105

118-
With these configuration changes, PGO will create a Role and RoleBinding, and will therefore only manage PostgreSQL clusters created within the namespace defined using the `namespace` setting in the
119-
`kustomize/install/bases/kustomization.yaml` file:
106+
Once the Kustomize project has been modified according to your specific needs, PGO can then
107+
be installed using `kubectl` and Kustomize. To create the target namespace, run the following:
120108

121-
```yaml
122-
namespace: postgres-operator
109+
```shell
110+
kubectl apply -k kustomize/install/namespace
123111
```
124112

125-
## Install
113+
This will create the default `postgres-operator` namespace, unless you have edited the
114+
`kustomize/install/namespace/namespace.yaml` resource. That `Namespace` resource should have the
115+
same value as the `namespace` field in the `kustomization.yaml` file (located either at
116+
`kustomize/install/default` or `kustomize/install/singlenamespace`, depending on whether you
117+
are deploying the operator with cluster-wide or namespace-limited permissions).
126118

127-
Once the Kustomize project has been modified according to your specific needs, PGO can then
128-
be installed using `kubectl` and Kustomize. To create both the target namespace for PGO and
129-
then install PGO itself, the following command can be utilized:
119+
To install PGO itself in cluster-wide mode, apply the kustomization file in the `default` folder:
130120

131121
```shell
132-
kubectl apply -k kustomize/install
122+
kubectl apply -k kustomize/install/default
133123
```
134124

135-
However, if the namespace has already been created, the following command can be utilized to
136-
install PGO only:
125+
To install PGO itself in namespace-limited mode, apply the kustomization file in the
126+
`singlenamespace` folder:
137127

138128
```shell
139-
kubectl apply -k kustomize/install/bases
129+
kubectl apply -k kustomize/install/singlenamespace
140130
```
141131

132+
The `kustomization.yaml` files in those folders take care of applying the appropriate permissions.
133+
142134
### Automated Upgrade Checks
143135

144136
By default, PGO will automatically check for updates to itself and software components by making a request to a URL. If PGO detects there are updates available, it will print them in the logs. As part of the check, PGO will send aggregated, anonymized information about the current deployment to the endpoint. An upcoming release will allow for PGO to opt-in to receive and apply updates to software components automatically.
@@ -148,17 +140,21 @@ PGO will check for updates upon startup and once every 24 hours. Any errors in c
148140
## Uninstall
149141

150142
Once PGO has been installed, it can also be uninstalled using `kubectl` and Kustomize.
151-
To uninstall PGO and then also delete the namespace it had been deployed into (assuming the
152-
namespace was previously created using the Kustomize installer as described above), the
153-
following command can be utilized:
143+
To uninstall PGO (assuming it was installed in cluster-wide mode), the following command can be
144+
utilized:
145+
146+
```shell
147+
kubectl delete -k kustomize/install/default
148+
```
149+
150+
To uninstall PGO installed with only namespace permissions, use:
154151

155152
```shell
156-
kubectl delete -k kustomize/install
153+
kubectl delete -k kustomize/install/singlenamespace
157154
```
158155

159-
To uninstall PGO only (e.g. if Kustomize was not initially utilized to create the PGO namespace),
160-
the following command can be utilized:
156+
The namespace created with this installation can likewise be cleaned up with:
161157

162158
```shell
163-
kubectl delete -k kustomize/install/bases
159+
kubectl delete -k kustomize/install/namespace
164160
```

0 commit comments

Comments
 (0)