Skip to content

Instantly share code, notes, and snippets.

@iamonkara
Created March 18, 2019 19:31
Show Gist options
  • Save iamonkara/40102859daf45ece6cc9a3ae70612944 to your computer and use it in GitHub Desktop.
Save iamonkara/40102859daf45ece6cc9a3ae70612944 to your computer and use it in GitHub Desktop.
getting started with Zalando postgres operator
postgres-operator|master ⇒ k config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
hak8s.handoffs.tech hak8s.handoffs.tech hak8s.handoffs.tech
* minikube minikube minikube
postgres-operator|master ⇒ # start the operator; may take a few seconds
kubectl create -f manifests/configmap.yaml # configuration
kubectl create -f manifests/operator-service-account-rbac.yaml # identity and permissions
kubectl create -f manifests/postgres-operator.yaml # deployment
# create a Postgres cluster in a non-default namespace
kubectl create namespace test
kubectl config set-context minikube --namespace=test
kubectl create -f manifests/minimal-postgres-manifest.yaml
# connect to the Postgres master via psql
# operator creates the relevant k8s secret
export HOST_PORT=$(minikube service --namespace test acid-minimal-cluster --url | sed 's,.*/,,')
export PGHOST=$(echo $HOST_PORT | cut -d: -f 1)
export PGPORT=$(echo $HOST_PORT | cut -d: -f 2)
export PGPASSWORD=$(kubectl get secret postgres.acid-minimal-cluster.credentials -o 'jsonpath={.data.password}' | base64 -d)
psql -U postgres
configmap/postgres-operator created
serviceaccount/zalando-postgres-operator created
clusterrole.rbac.authorization.k8s.io/zalando-postgres-operator created
clusterrolebinding.rbac.authorization.k8s.io/zalando-postgres-operator created
deployment.apps/postgres-operator created
namespace/test created
Context "minikube" modified.
error: unable to recognize "manifests/minimal-postgres-manifest.yaml": no matches for kind "postgresql" in version "acid.zalan.do/v1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment