Helm
Installing Crunchy Postgres for Kubernetes Using Helm
This section provides instructions for installing and configuring Crunchy Postgres for Kubernetes using Helm.
If you are deploying using the installer from the Crunchy Data Customer Portal, please refer to the guide there for alternative setup information.
Crunchy Data hosts an OCI registry that helm can use directly. (Not all helm commands support OCI registries. For more information on which commands can be used, see the Helm documentation.)
Install
You can install Crunchy Postgres for Kubernetes directly from the registry using the helm install command:
helm install pgo oci://registry.developers.crunchydata.com/crunchydata/pgo
Or to see what values are set in the default values.yaml before installing, you could run a helm show command just as you would with any other registry:
helm show values oci://registry.developers.crunchydata.com/crunchydata/pgo
Downloading and Customizing the Chart
If you need to customize the Helm chart before installation, you can download it from the Crunchy Container Registry using helm pull:
helm pull oci://registry.developers.crunchydata.com/crunchydata/pgo
Once the Helm chart has been downloaded, uncompress the bundle:
tar -xvf pgo-6.0.0.tgz
You can then modify the chart locally and install it using the local path:
helm install pgo -n postgres-operator ./pgo
Configuration
The values.yaml file for the Helm chart contains all of the available configuration settings for Crunchy Postgres for Kubernetes. The default values.yaml settings should work in most Kubernetes environments, but it may require some customization depending on your specific environment and needs.
For instance, it might be necessary to customize the image tags that are utilized using the controllerImages setting:
controllerImages:
cluster: registry.developers.crunchydata.com/crunchydata/postgres-operator:ubi9-6.0.0-0
You can set values during installation using the --set flag:
helm install pgo oci://registry.developers.crunchydata.com/crunchydata/pgo --set controllerImages.cluster=registry.developers.crunchydata.com/crunchydata/postgres-operator:ubi9-6.0.0-0
Or by providing a custom values file:
helm install pgo oci://registry.developers.crunchydata.com/crunchydata/pgo -f my-values.yaml
If you are deploying using the images from the Crunchy Data Customer Portal, please refer to the private registries guide for additional setup information.
Logging
By default, Crunchy Postgres for Kubernetes deploys with debug logging turned on. If you wish to disable this, you need to set the debug attribute to false:
helm install pgo oci://registry.developers.crunchydata.com/crunchydata/pgo --set debug=false
Or in a values file:
debug: false
Installation Mode
When Crunchy Postgres for Kubernetes is installed, it can be configured to manage PostgreSQL clusters in all namespaces within the Kubernetes cluster, just those within a single namespace, or those in a select set of namespaces. When managing PostgreSQL clusters in multiple namespaces, a ClusterRole and ClusterRoleBinding is created to ensure Crunchy Postgres for Kubernetes has the permissions it requires to properly manage PostgreSQL clusters across all namespaces. However, when Crunchy Postgres for Kubernetes is configured to manage PostgreSQL clusters within a single namespace only, a Role and RoleBinding is created instead.
In order to select between the multi-namespace and single-namespace modes when installing Crunchy Postgres for Kubernetes using Helm, the singleNamespace setting can be utilized:
singleNamespace: false
Specifically, if this setting is set to false (which is the default), then a ClusterRole and ClusterRoleBinding will be created, and Crunchy Postgres for Kubernetes will be able to manage PostgreSQL clusters in multiple namespaces. By default, the operator will manage PostgreSQL clusters in all namespaces.
If you wish for the operator to only manage PostgreSQL clusters in a select set of namespaces, you can use the extraEnv value to set the PGO_TARGET_NAMESPACES environment variable. You can view the default values file with helm show values oci://registry.developers.crunchydata.com/crunchydata/pgo and create your own values file:
extraEnv:
- name: PGO_TARGET_NAMESPACES
value: "namespace-one,namespace-two,namespace-three"
However, if the singleNamespace setting is set to true, then a Role and RoleBinding will be created instead, allowing Crunchy Postgres for Kubernetes to only manage PostgreSQL clusters in the same namespace utilized when installing the Crunchy Postgres for Kubernetes Helm chart.
High Availability
Starting in CPK 5.7, the operator can run in a typical hot/cold high availability configuration. When enabled, one pod will be the leader, while others wait to become the leader should the current leader fail. This capability is controlled by the pgoControllerLeaseName value in the values.yaml file. That value names the Lease object used to elect a leader of the PGO deployment via the PGO_CONTROLLER_LEASE_NAME environment variable. The default is cpk-leader-election-lease, so you can achieve high availability by setting replicas greater than one.
If you wish to disable this capability, set pgoControllerLeaseName to an empty value and replicas to 1.
Health Probes
Starting in CPK 5.7, the operator has the ability to perform liveness and readiness health probes. These probes are set on the operator Deployment and are enabled by default with the following settings:
livenessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
To disable these probes, download the chart and remove them from the operator Deployment.
Uninstall
To uninstall Crunchy Postgres for Kubernetes, remove all your PostgresCluster objects, then use the helm uninstall command:
helm uninstall pgo -n postgres-operator
Helm leaves the CRDs in place. You can list them with kubectl get crd | grep postgres-operator.crunchydata.com and remove them manually with kubectl delete crd.
Next Step: Create a Postgres Cluster
Now that you've installed Crunchy Postgres for Kubernetes, you're ready to Create a Postgres Cluster.
Next Step: Install Monitoring
No installation of Crunchy Postgres for Kubernetes is complete without monitoring! See our Tutorial on installing monitoring with Helm for details.