mirror of
https://github.com/wardviaene/kubernetes-course.git
synced 2026-02-14 17:49:56 +00:00
postgres pgo 5
This commit is contained in:
@@ -9,50 +9,46 @@ kubectl create -f storage.yml
|
||||
# setup Operator
|
||||
```
|
||||
./quickstart.sh
|
||||
./set-path.sh
|
||||
```
|
||||
|
||||
After these commands you'll need to logout and login again.
|
||||
|
||||
# port forwarding
|
||||
|
||||
```
|
||||
kubectl get pods -n pgo
|
||||
kubectl port-forward -n pgo postgres-operator-xxx-yyy 8443:8443
|
||||
```
|
||||
|
||||
# Test command
|
||||
|
||||
```
|
||||
pgo version
|
||||
```
|
||||
|
||||
# Create cluster
|
||||
|
||||
```
|
||||
pgo create cluster mycluster
|
||||
kubectl apply -f postgres-example.yaml
|
||||
```
|
||||
|
||||
# Show cluster pods
|
||||
|
||||
```
|
||||
kubectl get pods -n postgres-operator
|
||||
```
|
||||
|
||||
# show secrets
|
||||
```
|
||||
pgo show cluster mycluster
|
||||
kubectl get secrets -n postgres-operator hippo-pguser-hippo -o yaml |grep user |cut -d ':' -f2 |cut -d ' ' -f2 |base64 --decode
|
||||
kubectl get secrets -n postgres-operator hippo-pguser-hippo -o yaml |grep password |cut -d ':' -f2 |cut -d ' ' -f2 |base64 --decode
|
||||
kubectl get secrets -n postgres-operator hippo-pguser-hippo -o yaml |grep host |cut -d ':' -f2 |cut -d ' ' -f2 |base64 --decode
|
||||
```
|
||||
|
||||
# connect to psql
|
||||
|
||||
Use user, password, and host from previous step.
|
||||
|
||||
```
|
||||
pgo show user mycluster
|
||||
kubectl run -it --rm --image=postgres:10.4 psql-client -- psql -h mycluster.pgo -U testuser -W postgres
|
||||
kubectl run -n postgres-operator -it --rm --image=postgres:10.4 psql-client -- psql -h hippo-primary.postgres-operator.svc -U hippo -W postgres
|
||||
```
|
||||
|
||||
Note: When you see 'If you don't see a command prompt, try pressing enter.', you can enter the password
|
||||
|
||||
|
||||
# Create read replic
|
||||
Once you add replicas: 2 to the yaml definition, and you apply it, you'll see the new replica being spun up
|
||||
```
|
||||
pgo scale mycluster
|
||||
kubectl apply -f postgres-example-scale.yaml
|
||||
kubectl get pods -n postgres-operator
|
||||
```
|
||||
|
||||
# manually failover
|
||||
# Shutdown cluster
|
||||
```
|
||||
pgo failover mycluster --query
|
||||
pgo failover mycluster --target=mycluster-xxx
|
||||
kubectl get pgtasks mycluster-failover -o yaml
|
||||
kubectl patch postgrescluster/hippo -n postgres-operator --type merge --patch '{"spec":{"shutdown": true}}'
|
||||
```
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2020 Crunchy Data Solutions, Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script should be run after the operator has been deployed
|
||||
PGO_OPERATOR_NAMESPACE="${PGO_OPERATOR_NAMESPACE:-pgo}"
|
||||
PGO_USER_ADMIN="${PGO_USER_ADMIN:-pgouser-admin}"
|
||||
PGO_CLIENT_VERSION="${PGO_CLIENT_VERSION:-v4.7.0}"
|
||||
PGO_CLIENT_URL="https://github.com/CrunchyData/postgres-operator/releases/download/${PGO_CLIENT_VERSION}"
|
||||
|
||||
PGO_CMD="${PGO_CMD-kubectl}"
|
||||
|
||||
# Checks operating system and determines which binary to download
|
||||
UNAME_RESULT=$(uname)
|
||||
if [[ "${UNAME_RESULT}" == "Linux" ]]
|
||||
then
|
||||
BIN_NAME="pgo"
|
||||
elif [[ "${UNAME_RESULT}" == "Darwin" ]]
|
||||
then
|
||||
BIN_NAME="pgo-mac"
|
||||
else
|
||||
echo "${UNAME_RESULT} is not supported, valid operating systems are: Linux, Darwin"
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Creates the output directory for files
|
||||
OUTPUT_DIR="${HOME}/.pgo/${PGO_OPERATOR_NAMESPACE}"
|
||||
install -d -m a-rwx,u+rwx "${OUTPUT_DIR}"
|
||||
|
||||
echo "Operating System found is ${UNAME_RESULT}. Downloading ${BIN_NAME} client binary..."
|
||||
|
||||
curl -C - -Lo "${OUTPUT_DIR}/pgo" "${PGO_CLIENT_URL}/${BIN_NAME}"
|
||||
chmod +x "${OUTPUT_DIR}/pgo"
|
||||
|
||||
|
||||
# Check that the pgouser-admin secret exists
|
||||
if [ -z "$($PGO_CMD get secret -n ${PGO_OPERATOR_NAMESPACE} ${PGO_USER_ADMIN})" ]
|
||||
then
|
||||
echo "${PGO_USER_ADMIN} Secret not found in namespace: ${PGO_OPERATOR_NAMESPACE}"
|
||||
echo "Please ensure that the PostgreSQL Operator has been installed."
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check that the pgo.tls secret exists
|
||||
if [ -z "$($PGO_CMD get secret -n ${PGO_OPERATOR_NAMESPACE} pgo.tls)" ]
|
||||
then
|
||||
echo "pgo.tls Secret not found in namespace: ${PGO_OPERATOR_NAMESPACE}"
|
||||
echo "Please ensure that the PostgreSQL Operator has been installed."
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Restrict access to the target file before writing
|
||||
kubectl_get_private() { touch "$1" && chmod a-rwx,u+rw "$1" && $PGO_CMD get > "$1" "${@:2}"; }
|
||||
|
||||
# Use the pgouser-admin secret to generate pgouser file
|
||||
kubectl_get_private "${OUTPUT_DIR}/pgouser" secret -n "${PGO_OPERATOR_NAMESPACE}" "${PGO_USER_ADMIN}" \
|
||||
-o 'go-template={{ .data.username | base64decode }}:{{ .data.password | base64decode }}'
|
||||
|
||||
# Use the pgo.tls secret to generate the client cert files
|
||||
kubectl_get_private "${OUTPUT_DIR}/client.crt" secret -n "${PGO_OPERATOR_NAMESPACE}" pgo.tls -o 'go-template={{ index .data "tls.crt" | base64decode }}'
|
||||
kubectl_get_private "${OUTPUT_DIR}/client.key" secret -n "${PGO_OPERATOR_NAMESPACE}" pgo.tls -o 'go-template={{ index .data "tls.key" | base64decode }}'
|
||||
|
||||
echo "pgo client files have been generated, please add the following to your bashrc"
|
||||
echo "export PATH=${OUTPUT_DIR}:\$PATH"
|
||||
echo "export PGOUSER=${OUTPUT_DIR}/pgouser"
|
||||
echo "export PGO_CA_CERT=${OUTPUT_DIR}/client.crt"
|
||||
echo "export PGO_CLIENT_CERT=${OUTPUT_DIR}/client.crt"
|
||||
echo "export PGO_CLIENT_KEY=${OUTPUT_DIR}/client.key"
|
||||
29
postgres-operator/postgres-example-scale.yaml
Normal file
29
postgres-operator/postgres-example-scale.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
apiVersion: postgres-operator.crunchydata.com/v1beta1
|
||||
kind: PostgresCluster
|
||||
metadata:
|
||||
name: hippo
|
||||
namespace: postgres-operator
|
||||
spec:
|
||||
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:centos8-13.5-0
|
||||
postgresVersion: 13
|
||||
instances:
|
||||
- name: instance1
|
||||
replicas: 2
|
||||
dataVolumeClaimSpec:
|
||||
accessModes:
|
||||
- "ReadWriteOnce"
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
backups:
|
||||
pgbackrest:
|
||||
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-2.36-0
|
||||
repos:
|
||||
- name: repo1
|
||||
volume:
|
||||
volumeClaimSpec:
|
||||
accessModes:
|
||||
- "ReadWriteOnce"
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
28
postgres-operator/postgres-example.yaml
Normal file
28
postgres-operator/postgres-example.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
apiVersion: postgres-operator.crunchydata.com/v1beta1
|
||||
kind: PostgresCluster
|
||||
metadata:
|
||||
name: hippo
|
||||
namespace: postgres-operator
|
||||
spec:
|
||||
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:centos8-13.5-0
|
||||
postgresVersion: 13
|
||||
instances:
|
||||
- name: instance1
|
||||
dataVolumeClaimSpec:
|
||||
accessModes:
|
||||
- "ReadWriteOnce"
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
backups:
|
||||
pgbackrest:
|
||||
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-2.36-0
|
||||
repos:
|
||||
- name: repo1
|
||||
volume:
|
||||
volumeClaimSpec:
|
||||
accessModes:
|
||||
- "ReadWriteOnce"
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
@@ -1,305 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: pgo-deployer-sa
|
||||
namespace: pgo
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: pgo-deployer-cr
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- namespaces
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- create
|
||||
- patch
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- list
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- configmaps
|
||||
- services
|
||||
- persistentvolumeclaims
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- serviceaccounts
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- patch
|
||||
- apiGroups:
|
||||
- apps
|
||||
- extensions
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
resources:
|
||||
- clusterroles
|
||||
- clusterrolebindings
|
||||
- roles
|
||||
- rolebindings
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- bind
|
||||
- escalate
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
resources:
|
||||
- roles
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- batch
|
||||
resources:
|
||||
- jobs
|
||||
verbs:
|
||||
- delete
|
||||
- apiGroups:
|
||||
- crunchydata.com
|
||||
resources:
|
||||
- pgclusters
|
||||
- pgreplicas
|
||||
- pgpolicies
|
||||
- pgtasks
|
||||
verbs:
|
||||
- delete
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: pgo-deployer-crb
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: pgo-deployer-cr
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: pgo-deployer-sa
|
||||
namespace: pgo
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: pgo-deploy
|
||||
namespace: pgo
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
metadata:
|
||||
name: pgo-deploy
|
||||
spec:
|
||||
serviceAccountName: pgo-deployer-sa
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: pgo-deploy
|
||||
image: registry.developers.crunchydata.com/crunchydata/pgo-deployer:centos7-4.3.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: ARCHIVE_MODE
|
||||
value: "true"
|
||||
- name: ARCHIVE_TIMEOUT
|
||||
value: "60"
|
||||
- name: BACKREST
|
||||
value: "true"
|
||||
- name: BADGER
|
||||
value: "false"
|
||||
- name: CRUNCHY_DEBUG
|
||||
value: "false"
|
||||
- name: CREATE_RBAC
|
||||
value: "true"
|
||||
- name: CCP_IMAGE_PREFIX
|
||||
value: "registry.developers.crunchydata.com/crunchydata"
|
||||
- name: CCP_IMAGE_TAG
|
||||
value: "centos7-12.3-4.3.2"
|
||||
- name: DB_PASSWORD_LENGTH
|
||||
value: "24"
|
||||
- name: DB_PORT
|
||||
value: "5432"
|
||||
- name: DB_REPLICAS
|
||||
value: "0"
|
||||
- name: DB_USER
|
||||
value: "testuser"
|
||||
- name: DEFAULT_INSTANCE_MEMORY
|
||||
value: "128Mi"
|
||||
- name: DEFAULT_PGBACKREST_MEMORY
|
||||
value: ""
|
||||
- name: DEFAULT_PGBOUNCER_MEMORY
|
||||
value: ""
|
||||
- name: DEPLOY_ACTION
|
||||
value: "install"
|
||||
- name: DISABLE_AUTO_FAILOVER
|
||||
value: "false"
|
||||
- name: DISABLE_FSGROUP
|
||||
value: "false"
|
||||
- name: DYNAMIC_RBAC
|
||||
value: "false"
|
||||
- name: EXPORTERPORT
|
||||
value: "9187"
|
||||
- name: METRICS
|
||||
value: "false"
|
||||
- name: NAMESPACE
|
||||
value: "pgo"
|
||||
- name: NAMESPACE_MODE
|
||||
value: "dynamic"
|
||||
- name: PGBADGERPORT
|
||||
value: "10000"
|
||||
- name: PGO_ADMIN_PASSWORD
|
||||
value: "password"
|
||||
- name: PGO_ADMIN_PERMS
|
||||
value: "*"
|
||||
- name: PGO_ADMIN_ROLE_NAME
|
||||
value: "pgoadmin"
|
||||
- name: PGO_ADMIN_USERNAME
|
||||
value: "admin"
|
||||
- name: PGO_CLIENT_VERSION
|
||||
value: "v4.3.2"
|
||||
- name: PGO_IMAGE_PREFIX
|
||||
value: "registry.developers.crunchydata.com/crunchydata"
|
||||
- name: PGO_IMAGE_TAG
|
||||
value: "centos7-4.3.2"
|
||||
- name: PGO_INSTALLATION_NAME
|
||||
value: "devtest"
|
||||
- name: PGO_OPERATOR_NAMESPACE
|
||||
value: "pgo"
|
||||
- name: SCHEDULER_TIMEOUT
|
||||
value: "3600"
|
||||
- name: BACKREST_STORAGE
|
||||
value: "hostpathstorage"
|
||||
- name: BACKUP_STORAGE
|
||||
value: "hostpathstorage"
|
||||
- name: PRIMARY_STORAGE
|
||||
value: "hostpathstorage"
|
||||
- name: REPLICA_STORAGE
|
||||
value: "hostpathstorage"
|
||||
- name: WAL_STORAGE
|
||||
value: ""
|
||||
- name: STORAGE1_NAME
|
||||
value: "hostpathstorage"
|
||||
- name: STORAGE1_ACCESS_MODE
|
||||
value: "ReadWriteMany"
|
||||
- name: STORAGE1_SIZE
|
||||
value: "1G"
|
||||
- name: STORAGE1_TYPE
|
||||
value: "create"
|
||||
- name: STORAGE2_NAME
|
||||
value: "replicastorage"
|
||||
- name: STORAGE2_ACCESS_MODE
|
||||
value: "ReadWriteMany"
|
||||
- name: STORAGE2_SIZE
|
||||
value: "700M"
|
||||
- name: STORAGE2_TYPE
|
||||
value: "create"
|
||||
- name: STORAGE3_NAME
|
||||
value: "nfsstorage"
|
||||
- name: STORAGE3_ACCESS_MODE
|
||||
value: "ReadWriteMany"
|
||||
- name: STORAGE3_SIZE
|
||||
value: "1G"
|
||||
- name: STORAGE3_TYPE
|
||||
value: "create"
|
||||
- name: STORAGE3_SUPPLEMENTAL_GROUPS
|
||||
value: "65534"
|
||||
- name: STORAGE4_NAME
|
||||
value: "nfsstoragered"
|
||||
- name: STORAGE4_ACCESS_MODE
|
||||
value: "ReadWriteMany"
|
||||
- name: STORAGE4_SIZE
|
||||
value: "1G"
|
||||
- name: STORAGE4_MATCH_LABEL
|
||||
value: "crunchyzone=red"
|
||||
- name: STORAGE4_TYPE
|
||||
value: "create"
|
||||
- name: STORAGE4_SUPPLEMENTAL_GROUPS
|
||||
value: "65534"
|
||||
- name: STORAGE5_NAME
|
||||
value: "storageos"
|
||||
- name: STORAGE5_ACCESS_MODE
|
||||
value: "ReadWriteOnce"
|
||||
- name: STORAGE5_SIZE
|
||||
value: "5Gi"
|
||||
- name: STORAGE5_TYPE
|
||||
value: "dynamic"
|
||||
- name: STORAGE5_CLASS
|
||||
value: "fast"
|
||||
- name: STORAGE6_NAME
|
||||
value: "primarysite"
|
||||
- name: STORAGE6_ACCESS_MODE
|
||||
value: "ReadWriteOnce"
|
||||
- name: STORAGE6_SIZE
|
||||
value: "4G"
|
||||
- name: STORAGE6_TYPE
|
||||
value: "dynamic"
|
||||
- name: STORAGE6_CLASS
|
||||
value: "primarysite"
|
||||
- name: STORAGE7_NAME
|
||||
value: "alternatesite"
|
||||
- name: STORAGE7_ACCESS_MODE
|
||||
value: "ReadWriteOnce"
|
||||
- name: STORAGE7_SIZE
|
||||
value: "4G"
|
||||
- name: STORAGE7_TYPE
|
||||
value: "dynamic"
|
||||
- name: STORAGE7_CLASS
|
||||
value: "alternatesite"
|
||||
- name: STORAGE8_NAME
|
||||
value: "gce"
|
||||
- name: STORAGE8_ACCESS_MODE
|
||||
value: "ReadWriteOnce"
|
||||
- name: STORAGE8_SIZE
|
||||
value: "300M"
|
||||
- name: STORAGE8_TYPE
|
||||
value: "dynamic"
|
||||
- name: STORAGE8_CLASS
|
||||
value: "standard"
|
||||
- name: STORAGE9_NAME
|
||||
value: "rook"
|
||||
- name: STORAGE9_ACCESS_MODE
|
||||
value: "ReadWriteOnce"
|
||||
- name: STORAGE9_SIZE
|
||||
value: "1Gi"
|
||||
- name: STORAGE9_TYPE
|
||||
value: "dynamic"
|
||||
- name: STORAGE9_CLASS
|
||||
value: "rook-ceph-block"
|
||||
@@ -1,287 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: pgo-deployer-sa
|
||||
namespace: pgo
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: pgo-deployer-cr
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- namespaces
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- create
|
||||
- patch
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- list
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- list
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- configmaps
|
||||
- services
|
||||
- persistentvolumeclaims
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- list
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- serviceaccounts
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- patch
|
||||
- list
|
||||
- apiGroups:
|
||||
- apps
|
||||
- extensions
|
||||
resources:
|
||||
- deployments
|
||||
- replicasets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
resources:
|
||||
- clusterroles
|
||||
- clusterrolebindings
|
||||
- roles
|
||||
- rolebindings
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
- bind
|
||||
- escalate
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
resources:
|
||||
- roles
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- batch
|
||||
resources:
|
||||
- jobs
|
||||
verbs:
|
||||
- delete
|
||||
- list
|
||||
- apiGroups:
|
||||
- crunchydata.com
|
||||
resources:
|
||||
- pgclusters
|
||||
- pgreplicas
|
||||
- pgpolicies
|
||||
- pgtasks
|
||||
verbs:
|
||||
- delete
|
||||
- list
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: pgo-deployer-cm
|
||||
namespace: pgo
|
||||
data:
|
||||
values.yaml: |-
|
||||
# =====================
|
||||
# Configuration Options
|
||||
# More info for these options can be found in the docs
|
||||
# https://access.crunchydata.com/documentation/postgres-operator/latest/installation/configuration/
|
||||
# =====================
|
||||
archive_mode: "true"
|
||||
archive_timeout: "60"
|
||||
backrest_aws_s3_bucket: ""
|
||||
backrest_aws_s3_endpoint: ""
|
||||
backrest_aws_s3_key: ""
|
||||
backrest_aws_s3_region: ""
|
||||
backrest_aws_s3_secret: ""
|
||||
backrest_aws_s3_uri_style: ""
|
||||
backrest_aws_s3_verify_tls: "true"
|
||||
backrest_gcs_bucket: ""
|
||||
backrest_gcs_endpoint: ""
|
||||
backrest_gcs_key_type: ""
|
||||
backrest_port: "2022"
|
||||
badger: "false"
|
||||
ccp_image_prefix: "registry.developers.crunchydata.com/crunchydata"
|
||||
ccp_image_pull_secret: ""
|
||||
ccp_image_pull_secret_manifest: ""
|
||||
ccp_image_tag: "centos8-13.3-4.7.0"
|
||||
create_rbac: "true"
|
||||
crunchy_debug: "false"
|
||||
db_name: ""
|
||||
db_password_age_days: "0"
|
||||
db_password_length: "24"
|
||||
db_port: "5432"
|
||||
db_replicas: "0"
|
||||
db_user: "testuser"
|
||||
default_instance_memory: "128Mi"
|
||||
default_pgbackrest_memory: "48Mi"
|
||||
default_pgbouncer_memory: "24Mi"
|
||||
default_exporter_memory: "24Mi"
|
||||
delete_operator_namespace: "false"
|
||||
delete_watched_namespaces: "false"
|
||||
disable_auto_failover: "false"
|
||||
disable_fsgroup: "false"
|
||||
reconcile_rbac: "true"
|
||||
exporterport: "9187"
|
||||
metrics: "false"
|
||||
namespace: "pgo"
|
||||
namespace_mode: "dynamic"
|
||||
pgbadgerport: "10000"
|
||||
pgo_add_os_ca_store: "false"
|
||||
pgo_admin_password: "examplepassword"
|
||||
pgo_admin_perms: "*"
|
||||
pgo_admin_role_name: "pgoadmin"
|
||||
pgo_admin_username: "admin"
|
||||
pgo_apiserver_port: "8443"
|
||||
pgo_apiserver_url: "https://postgres-operator"
|
||||
pgo_client_cert_secret: "pgo.tls"
|
||||
pgo_client_container_install: "false"
|
||||
pgo_client_install: "true"
|
||||
pgo_client_version: "4.7.0"
|
||||
pgo_cluster_admin: "false"
|
||||
pgo_disable_eventing: "false"
|
||||
pgo_disable_tls: "false"
|
||||
pgo_image_prefix: "registry.developers.crunchydata.com/crunchydata"
|
||||
pgo_image_pull_secret: ""
|
||||
pgo_image_pull_secret_manifest: ""
|
||||
pgo_image_tag: "centos8-4.7.0"
|
||||
pgo_installation_name: "devtest"
|
||||
pgo_noauth_routes: ""
|
||||
pgo_operator_namespace: "pgo"
|
||||
pgo_tls_ca_store: ""
|
||||
pgo_tls_no_verify: "false"
|
||||
pod_anti_affinity: "preferred"
|
||||
pod_anti_affinity_pgbackrest: ""
|
||||
pod_anti_affinity_pgbouncer: ""
|
||||
scheduler_timeout: "3600"
|
||||
service_type: "ClusterIP"
|
||||
sync_replication: "false"
|
||||
backrest_storage: "default"
|
||||
backup_storage: "default"
|
||||
primary_storage: "default"
|
||||
replica_storage: "default"
|
||||
pgadmin_storage: "default"
|
||||
wal_storage: ""
|
||||
storage1_name: "default"
|
||||
storage1_access_mode: "ReadWriteOnce"
|
||||
storage1_size: "1G"
|
||||
storage1_type: "dynamic"
|
||||
storage2_name: "hostpathstorage"
|
||||
storage2_access_mode: "ReadWriteMany"
|
||||
storage2_size: "1G"
|
||||
storage2_type: "create"
|
||||
storage3_name: "nfsstorage"
|
||||
storage3_access_mode: "ReadWriteMany"
|
||||
storage3_size: "1G"
|
||||
storage3_type: "create"
|
||||
storage3_supplemental_groups: "65534"
|
||||
storage4_name: "nfsstoragered"
|
||||
storage4_access_mode: "ReadWriteMany"
|
||||
storage4_size: "1G"
|
||||
storage4_match_labels: "crunchyzone=red"
|
||||
storage4_type: "create"
|
||||
storage4_supplemental_groups: "65534"
|
||||
storage5_name: "storageos"
|
||||
storage5_access_mode: "ReadWriteOnce"
|
||||
storage5_size: "5Gi"
|
||||
storage5_type: "dynamic"
|
||||
storage5_class: "fast"
|
||||
storage6_name: "primarysite"
|
||||
storage6_access_mode: "ReadWriteOnce"
|
||||
storage6_size: "4G"
|
||||
storage6_type: "dynamic"
|
||||
storage6_class: "primarysite"
|
||||
storage7_name: "alternatesite"
|
||||
storage7_access_mode: "ReadWriteOnce"
|
||||
storage7_size: "4G"
|
||||
storage7_type: "dynamic"
|
||||
storage7_class: "alternatesite"
|
||||
storage8_name: "gce"
|
||||
storage8_access_mode: "ReadWriteOnce"
|
||||
storage8_size: "300M"
|
||||
storage8_type: "dynamic"
|
||||
storage8_class: "standard"
|
||||
storage9_name: "rook"
|
||||
storage9_access_mode: "ReadWriteOnce"
|
||||
storage9_size: "1Gi"
|
||||
storage9_type: "dynamic"
|
||||
storage9_class: "rook-ceph-block"
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: pgo-deployer-crb
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: pgo-deployer-cr
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: pgo-deployer-sa
|
||||
namespace: pgo
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: pgo-deploy
|
||||
namespace: pgo
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
metadata:
|
||||
name: pgo-deploy
|
||||
spec:
|
||||
serviceAccountName: pgo-deployer-sa
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: pgo-deploy
|
||||
image: registry.developers.crunchydata.com/crunchydata/pgo-deployer:centos8-4.7.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: DEPLOY_ACTION
|
||||
value: install
|
||||
volumeMounts:
|
||||
- name: deployer-conf
|
||||
mountPath: "/conf"
|
||||
volumes:
|
||||
- name: deployer-conf
|
||||
configMap:
|
||||
name: pgo-deployer-cm
|
||||
@@ -6,8 +6,11 @@ echo "- Create the pgo namespace"
|
||||
echo "- Apply postgres-operator.yml"
|
||||
echo "- install the client"
|
||||
echo ""
|
||||
kubectl create namespace pgo
|
||||
kubectl apply -f postgres-operator.yml
|
||||
echo "wait until deploy job is complete..."
|
||||
kubectl wait --for=condition=complete --timeout=180s -n pgo job/pgo-deploy
|
||||
./client-setup.sh
|
||||
wget https://github.com/CrunchyData/postgres-operator-examples/archive/refs/heads/main.zip
|
||||
unzip main.zip
|
||||
kubectl apply -k postgres-operator-examples-main/kustomize/install
|
||||
echo "wait until pod is ready"
|
||||
sleep 15
|
||||
kubectl -n postgres-operator wait pods --selector=postgres-operator.crunchydata.com/control-plane=postgres-operator --field-selector=status.phase=Running --for=condition=ready
|
||||
|
||||
echo "pgo 4 is not compatible anymore with newer kubernetes cluster. PGO 5 has been installed. Check the README.md in this directory for the commands to launch a postgres cluster"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
kind: StorageClass
|
||||
apiVersion: storage.k8s.io/v1beta1
|
||||
apiVersion: storage.k8s.io/v1
|
||||
metadata:
|
||||
name: standard
|
||||
provisioner: kubernetes.io/aws-ebs
|
||||
|
||||
Reference in New Issue
Block a user