mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-07 00:41:28 +02:00
merge master and improve standy doc
This commit is contained in:
@@ -177,6 +177,22 @@ data:
|
||||
pod_antiaffinity_topology_key: "failure-domain.beta.kubernetes.io/zone"
|
||||
```
|
||||
|
||||
## Pod Disruption Budget
|
||||
|
||||
By default the operator uses a PodDisruptionBudget (PDB) to protect the cluster
|
||||
from voluntarily disruptions and hence unwanted DB downtime. The `MinAvailable`
|
||||
parameter of the PDB is set to `1` which prevents killing masters in single-node
|
||||
clusters and/or the last remaining running instance in a multi-node cluster.
|
||||
|
||||
The PDB is only relaxed in two scenarios:
|
||||
* If a cluster is scaled down to `0` instances (e.g. for draining nodes)
|
||||
* If the PDB is disabled in the configuration (`enable_pod_disruption_budget`)
|
||||
|
||||
The PDB is still in place having `MinAvailable` set to `0`. If enabled it will
|
||||
be automatically set to `1` on scale up. Disabling PDBs helps avoiding blocking
|
||||
Kubernetes upgrades in managed K8s environments at the cost of prolonged DB
|
||||
downtime. See PR #384 for the use case.
|
||||
|
||||
## Add cluster-specific labels
|
||||
|
||||
In some cases, you might want to add `labels` that are specific to a given
|
||||
@@ -371,6 +387,26 @@ monitoring is outside of the scope of operator responsibilities.
|
||||
configuration. Any such image must ensure the logical backup is able to finish
|
||||
[in presence of pod restarts](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#handling-pod-and-container-failures) and [simultaneous invocations](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#cron-job-limitations) of the backup cron job.
|
||||
|
||||
<<<<<<< HEAD
|
||||
5. For that feature to work, your RBAC policy must enable operations on the
|
||||
`cronjobs` resource from the `batch` API group for the operator service account.
|
||||
See [example RBAC](../manifests/operator-service-account-rbac.yaml)
|
||||
=======
|
||||
5. For that feature to work, your RBAC policy must enable operations on the `cronjobs` resource from the `batch` API group for the operator service account. See [example RBAC](../manifests/operator-service-account-rbac.yaml)
|
||||
|
||||
## Access to cloud resources from clusters in non cloud environment
|
||||
|
||||
To access cloud resources like S3 from a cluster in a bare metal setup you can use
|
||||
`additional_secret_mount` and `additional_secret_mount_path` config parameters.
|
||||
With this you can provision cloud credentials to the containers in the pods of the StatefulSet.
|
||||
This works this way that it mounts a volume from the given secret in the pod and this can
|
||||
then accessed in the container over the configured mount path. Via [Custum Pod Environment Variables](#custom-pod-environment-variables)
|
||||
you can then point the different cloud sdk's (aws, google etc.) to this mounted secret.
|
||||
With this credentials the cloud sdk can then access cloud resources to upload logs etc.
|
||||
|
||||
A secret can be pre provisioned in different ways:
|
||||
|
||||
* Generic secret created via `kubectl create secret generic some-cloud-creds --from-file=some-cloud-credentials-file.json`
|
||||
|
||||
* Automaticly provisioned via a Controller like [kube-aws-iam-controller](https://github.com/mikkeloscar/kube-aws-iam-controller). This controller would then also rotate the credentials. Please visit the documention for more information.
|
||||
>>>>>>> master
|
||||
|
||||
+5
-3
@@ -71,10 +71,12 @@ Please, report any issues discovered to https://github.com/zalando/postgres-oper
|
||||
|
||||
## Talks
|
||||
|
||||
1. "PostgreSQL and K8s: DBaaS without a vendor-lock" talk by Oleksii Kliukin, PostgreSQL Sessions 2018: [video](https://www.youtube.com/watch?v=q26U2rQcqMw) | [slides](https://speakerdeck.com/alexeyklyukin/postgresql-and-kubernetes-dbaas-without-a-vendor-lock)
|
||||
1. "Building your own PostgreSQL-as-a-Service on Kubernetes" talk by Alexander Kukushkin, KubeCon NA 2018: [video](https://www.youtube.com/watch?v=G8MnpkbhClc) | [slides](https://static.sched.com/hosted_files/kccna18/1d/Building%20your%20own%20PostgreSQL-as-a-Service%20on%20Kubernetes.pdf)
|
||||
|
||||
2. "PostgreSQL High Availability on Kubernetes with Patroni" talk by Oleksii Kliukin, Atmosphere 2018: [video](https://www.youtube.com/watch?v=cFlwQOPPkeg) | [slides](https://speakerdeck.com/alexeyklyukin/postgresql-high-availability-on-kubernetes-with-patroni)
|
||||
2. "PostgreSQL and Kubernetes: DBaaS without a vendor-lock" talk by Oleksii Kliukin, PostgreSQL Sessions 2018: [video](https://www.youtube.com/watch?v=q26U2rQcqMw) | [slides](https://speakerdeck.com/alexeyklyukin/postgresql-and-kubernetes-dbaas-without-a-vendor-lock)
|
||||
|
||||
2. "Blue elephant on-demand: Postgres + Kubernetes" talk by Oleksii Kliukin and Jan Mussler, FOSDEM 2018: [video](https://fosdem.org/2018/schedule/event/blue_elephant_on_demand_postgres_kubernetes/) | [slides (pdf)](https://www.postgresql.eu/events/fosdem2018/sessions/session/1735/slides/59/FOSDEM%202018_%20Blue_Elephant_On_Demand.pdf)
|
||||
3. "PostgreSQL High Availability on Kubernetes with Patroni" talk by Oleksii Kliukin, Atmosphere 2018: [video](https://www.youtube.com/watch?v=cFlwQOPPkeg) | [slides](https://speakerdeck.com/alexeyklyukin/postgresql-high-availability-on-kubernetes-with-patroni)
|
||||
|
||||
4. "Blue elephant on-demand: Postgres + Kubernetes" talk by Oleksii Kliukin and Jan Mussler, FOSDEM 2018: [video](https://fosdem.org/2018/schedule/event/blue_elephant_on_demand_postgres_kubernetes/) | [slides (pdf)](https://www.postgresql.eu/events/fosdem2018/sessions/session/1735/slides/59/FOSDEM%202018_%20Blue_Elephant_On_Demand.pdf)
|
||||
|
||||
3. "Kube-Native Postgres" talk by Josh Berkus, KubeCon 2017: [video](https://www.youtube.com/watch?v=Zn1vd7sQ_bc)
|
||||
|
||||
@@ -61,8 +61,8 @@ These parameters are grouped directly under the `spec` key in the manifest.
|
||||
It should be a [Spilo](https://github.com/zalando/spilo) image. Optional.
|
||||
|
||||
* **spiloFSGroup**
|
||||
the Persistent Volumes for the spilo pods in the StatefulSet will be owned
|
||||
and writable by the group ID specified. This will override the **spilo_fsgroup**
|
||||
the Persistent Volumes for the spilo pods in the StatefulSet will be owned and
|
||||
writable by the group ID specified. This will override the **spilo_fsgroup**
|
||||
operator parameter. This is required to run Spilo as a non-root process, but
|
||||
requires a custom spilo image. Note the FSGroup of a Pod cannot be changed
|
||||
without recreating a new Pod.
|
||||
@@ -150,8 +150,8 @@ Those parameters are grouped under the `postgresql` top-level key.
|
||||
|
||||
* **parameters**
|
||||
a dictionary of postgres parameter names and values to apply to the resulting
|
||||
cluster. Optional (Spilo automatically sets reasonable defaults for
|
||||
parameters like work_mem or max_connections).
|
||||
cluster. Optional (Spilo automatically sets reasonable defaults for parameters
|
||||
like work_mem or max_connections).
|
||||
|
||||
|
||||
## Patroni parameters
|
||||
@@ -255,8 +255,13 @@ under the `clone` top-level key and do not affect the already running cluster.
|
||||
timestamp. When this parameter is set the operator will not consider cloning
|
||||
from the live cluster, even if it is running, and instead goes to S3. Optional.
|
||||
|
||||
* **s3_wal_path**
|
||||
the url to S3 bucket containing the WAL archive of the cluster to be cloned.
|
||||
Optional.
|
||||
|
||||
* **s3_endpoint**
|
||||
the url of the S3-compatible service should be set when cloning from non AWS S3. Optional.
|
||||
the url of the S3-compatible service should be set when cloning from non AWS
|
||||
S3. Optional.
|
||||
|
||||
* **s3_access_key_id**
|
||||
the access key id, used for authentication on S3 service. Optional.
|
||||
@@ -265,8 +270,20 @@ under the `clone` top-level key and do not affect the already running cluster.
|
||||
the secret access key, used for authentication on S3 service. Optional.
|
||||
|
||||
* **s3_force_path_style**
|
||||
to enable path-style addressing(i.e., http://s3.amazonaws.com/BUCKET/KEY) when connecting to an S3-compatible service
|
||||
that lack of support for sub-domain style bucket URLs (i.e., http://BUCKET.s3.amazonaws.com/KEY). Optional.
|
||||
to enable path-style addressing(i.e., http://s3.amazonaws.com/BUCKET/KEY)
|
||||
when connecting to an S3-compatible service that lack of support for
|
||||
sub-domain style bucket URLs (i.e., http://BUCKET.s3.amazonaws.com/KEY).
|
||||
Optional.
|
||||
|
||||
## Standby cluster
|
||||
|
||||
On startup, an existing `standby` top-level key creates a standby Postgres
|
||||
cluster streaming from a remote location. So far only streaming from a S3 WAL
|
||||
archive is supported.
|
||||
|
||||
* **s3_wal_path**
|
||||
the url to S3 bucket containing the WAL archive of the remote primary.
|
||||
Optional.
|
||||
|
||||
## EBS volume resizing
|
||||
|
||||
@@ -283,6 +300,9 @@ properties of the persistent storage that stores postgres data.
|
||||
documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/)
|
||||
for the details on storage classes. Optional.
|
||||
|
||||
* **subPath**
|
||||
Subpath to use when mounting volume into Spilo container
|
||||
|
||||
## Sidecar definitions
|
||||
|
||||
Those parameters are defined under the `sidecars` key. They consist of a list
|
||||
|
||||
@@ -162,6 +162,13 @@ configuration they are grouped under the `kubernetes` key.
|
||||
replaced by the cluster name. Only the `{cluster}` placeholders is allowed in
|
||||
the template.
|
||||
|
||||
* **enable_pod_disruption_budget**
|
||||
PDB is enabled by default to protect the cluster from voluntarily disruptions
|
||||
and hence unwanted DB downtime. However, on some cloud providers it could be
|
||||
necessary to temporarily disabled it, e.g. for node updates. See
|
||||
[admin docs](../administrator.md#pod-disruption-budget) for more information.
|
||||
Default is true.
|
||||
|
||||
* **secret_name_template**
|
||||
a template for the name of the database user secrets generated by the
|
||||
operator. `{username}` is replaced with name of the secret, `{cluster}` with
|
||||
@@ -400,7 +407,13 @@ yet officially supported.
|
||||
empty.
|
||||
|
||||
* **aws_region**
|
||||
AWS region used to store ESB volumes. The default is `eu-central-1`.
|
||||
AWS region used to store EBS volumes. The default is `eu-central-1`.
|
||||
|
||||
* **additional_secret_mount**
|
||||
Additional Secret (aws or gcp credentials) to mount in the pod. The default is empty.
|
||||
|
||||
* **additional_secret_mount_path**
|
||||
Path to mount the above Secret in the filesystem of the container(s). The default is empty.
|
||||
|
||||
## Logical backup
|
||||
|
||||
|
||||
@@ -280,6 +280,37 @@ spec:
|
||||
s3_force_path_style: true
|
||||
```
|
||||
|
||||
## Setting up a standby cluster
|
||||
|
||||
Standby clusters are like normal cluster but they are streaming from a remote
|
||||
cluster. As the first version of this feature, the only scenario covered by
|
||||
operator is to stream from a WAL archive of the master. Following the more
|
||||
popular infrastructure of using Amazon's S3 buckets, it is mentioned as
|
||||
`s3_wal_path` here. To make a cluster a standby add a `standby` section in the
|
||||
YAML file as follows.
|
||||
|
||||
```yaml
|
||||
spec:
|
||||
standby:
|
||||
s3_wal_path: "s3 bucket path to the master"
|
||||
```
|
||||
|
||||
Things to note:
|
||||
|
||||
- An empty string is provided in `s3_wal_path` of the standby cluster will
|
||||
result in error and no statefulset will be created.
|
||||
- Only one pod can be deployed for stand-by cluster.
|
||||
- To manually promote the standby_cluster, use patronictl and remove config
|
||||
entry.
|
||||
- There is no way to transform a non-standby cluster to become a standby cluster
|
||||
through operator. Hence, if a cluster is created without standby section in
|
||||
YAML and later modified by adding that section, there will be no effect on
|
||||
the cluster. However, it can be done through Patroni by adding the
|
||||
[standby_cluster] (https://github.com/zalando/patroni/blob/bd2c54581abb42a7d3a3da551edf0b8732eefd27/docs/replica_bootstrap.rst#standby-cluster)
|
||||
section using `patronictl edit-config`. Note that the transformed standby
|
||||
cluster will not be doing any streaming. It will be in standby mode and allow
|
||||
read-only transactions only.
|
||||
|
||||
## Sidecar Support
|
||||
|
||||
Each cluster can specify arbitrary sidecars to run. These containers could be
|
||||
|
||||
Reference in New Issue
Block a user