Vendor the base# Run these commands from the root of your Kubestack infra repositorywget https://storage.googleapis.com/catalog.kubestack.com/postgresql-v1.6.0-kbst.0.zipunzip -d manifests/bases/ postgresql-v1.6.0-kbst.0.ziprm postgresql-v1.6.0-kbst.0.zip
Include resource in apps overlaycd manifests/overlays/appskustomize edit add resource ../../bases/postgresql/clusterwide
Commit and pushcd -git checkout -b add-postgresqlgit add manifests/bases/postgresql manifests/overlays/apps/kustomization.yamlgit commit -m "Add postgresql v1.6.0-kbst.0 base"git push origin add-postgresql
Review PR and merge
Finally, review and merge the PR into master. Once it's been successfully applied against the Ops-Cluster set a prod-deploy tag to also apply the change against the Apps-Cluster.
To update the operator delete the previously vendored base and then vendor the new version.
Delete the previous vendored version# Run these commands from the root of your Kubestack infra repositoryrm -r manifests/bases/postgresql
Vendor the new version# Run these commands from the root of your Kubestack infra repositorywget https://storage.googleapis.com/catalog.kubestack.com/postgresql-v1.6.0-kbst.0.zipunzip -d manifests/bases/ postgresql-v1.6.0-kbst.0.ziprm postgresql-v1.6.0-kbst.0.zip
Commit and pushgit checkout -b update-postgresqlgit add manifests/bases/postgresqlgit commit -m "Update postgresql base to v1.6.0-kbst.0"git push origin update-postgresql
Operators often create resources based on custom objects. When removing an operator, follow a two-step process to ensure operator provisioned resources are purged properly.
- Remove all the operator's custom objects.
- Once the operator had time to de-provision all resources it created, follow the instructions below to remove the operator itself.
Remove resource from apps overlaycd manifests/overlays/appskustomize edit remove resource ../../bases/postgresql/clusterwide
Delete the vendored base from your repositorycd -# Run these commands from the root of your Kubestack infra repositoryrm -r manifests/bases/postgresql
Commit and pushgit checkout -b remove-postgresqlgit add manifests/bases/postgresqlgit commit -m "Remove postgresql base"git push origin remove-postgresql
Once the operator has been deployed to the Kubernetes cluster, you can use it to provision and operate one or more database clusters by creating a custom object of the operator's custom resource.
PostgreSQL Custom Object
Below is an example of a minimal PostgreSQL custom object to instruct the operator to provision a database cluster.
To get started, put the example below into a file called
postgresql.yaml and add it to your application's manifests. Then apply the manifests including the
postgresql.yaml as usual.
apiVersion: "acid.zalan.do/v1"kind: postgresqlmetadata:name: acid-minimal-clusternamespace: defaultspec:postgresql:version: "10"teamId: "ACID"volume:size: 1GinumberOfInstances: 2users:# admin useradmin:- superuser# application userapp_user: databases:# db_name: user_nameapp_db: app_user
Configuring your cluster
Make sure to configure name and namespace and the users and databases according to your application's requirements.
You can find additional information on these parameters and additional options in the upstream project's documentation.