Install Crunchy Data Postgres operator
Posted on May 1, 2021 (Last modified on July 11, 2024) • 2 min read • 370 wordsIt’s pretty simple, following the documentation, and tested with version 4.6.2 (commands super slightly adapted). Normally you might download the YAML file and adjust the installation settings in there, this is not done here (mainly because this is just a handling test).
export CRUNCHY_BASE=https://raw.githubusercontent.com/CrunchyData/postgres-operator
kubectl create namespace pgo
kubectl apply -f $CRUNCHY_BASE/v4.6.2/installers/kubectl/postgres-operator.yml
# install pgo binary - https://is.gd/U00wux
curl $CRUNCHY_BASE/v4.6.2/installers/kubectl/client-setup.sh > client-setup.sh
bash client-setup.sh
rm client-setup.sh
# THIS IS IMPORTANT
kubectl delete job -n pgo pgo-deploy
pgo
binary
Every time you want to use the binary you have to port-forward to the operator container, and set PGO_APISERVER_URL
:
# keep running
kubectl -n pgo port-forward svc/postgres-operator 8443:8443
# second shell
export PGO_APISERVER_URL="https://127.0.0.1:8443"
pgo version
Just apply the same manifest, but set the DEPLOY_ACTION
in the YAML postgres-operator.yaml
manifest to upgrade
. You can do this by downloading and modifying, or just in a one-liner:
export CRUNCHY_BASE=https://raw.githubusercontent.com/CrunchyData/postgres-operator
export CRUNCHY_YAML=$CRUNCHY_BASE/v4.6.2/installers/kubectl/postgres-operator.yml
curl $CRUNCHY_YAML | sed 's/value: install/value: upgrade/g' | kubectl apply -f -
NOTE: If you get a huge error message you forgot to delete the job after the installation.
Like upgrade, but with the value uninstall
.
export CRUNCHY_BASE=https://raw.githubusercontent.com/CrunchyData/postgres-operator
export CRUNCHY_YAML=$CRUNCHY_BASE/v4.6.2/installers/kubectl/postgres-operator.yml
curl $CRUNCHY_YAML | sed 's/value: install/value: uninstall/g' | kubectl apply -f -
NOTE: If you get a huge error message you forgot to delete the job after the installation.
Afterwards clean up the remaining stuff which is created by $CRUNCHY_YAML
defined above:
kubectl delete job -n pgo pgo-deploy
kubectl delete clusterrolebinding pgo-deployer-crb
kubectl delete configmap pgo-deployer-cm
kubectl delete clusterrole pgo-deployer-cr
kubectl delete serviceaccount pgo-deployer-sa
kubectl delete namespace pgo
pgo
binary is installed for every namespace you are using. This seems weird, it should somehow follow “standard” k8s RBAC, or the principle of kubectl
contexts.So … mixed. Haven’t tried the databases - yet.