-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some deployments docs & example (#96)
Signed-off-by: Igor Shishkin <me@teran.dev>
- Loading branch information
Showing
14 changed files
with
666 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: archived | ||
labels: | ||
app: archived |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Cluster | ||
metadata: | ||
name: metadatadb | ||
namespace: archived | ||
spec: | ||
instances: 3 | ||
imageName: ghcr.io/cloudnative-pg/postgresql:16.3-7 | ||
|
||
minSyncReplicas: 2 | ||
maxSyncReplicas: 2 | ||
|
||
postgresql: | ||
syncReplicaElectionConstraint: | ||
enabled: true | ||
nodeLabelsAntiAffinity: | ||
- topology.kubernetes.io/node | ||
|
||
replicationSlots: | ||
highAvailability: | ||
enabled: true | ||
updateInterval: 10 | ||
|
||
primaryUpdateStrategy: unsupervised | ||
switchoverDelay: 60 | ||
storage: | ||
pvcTemplate: | ||
resources: | ||
requests: | ||
storage: 30Gi | ||
storageClassName: openebs-hostpath | ||
volumeMode: Filesystem | ||
resizeInUseVolumes: false | ||
|
||
resources: | ||
requests: | ||
memory: "1Gi" | ||
cpu: 1 | ||
limits: | ||
memory: "1Gi" | ||
cpu: 1 | ||
|
||
backup: | ||
barmanObjectStore: | ||
destinationPath: "s3://<CHANGEME: backup bucket>" | ||
endpointURL: https://s3.example.com # (CHANGEME: s3 endpoint) | ||
s3Credentials: | ||
accessKeyId: | ||
name: cnpg-backup-creds | ||
key: ACCESS_KEY_ID | ||
secretAccessKey: | ||
name: cnpg-backup-creds | ||
key: ACCESS_SECRET_KEY | ||
retentionPolicy: "30d" | ||
|
||
monitoring: | ||
enablePodMonitor: true | ||
--- | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: ScheduledBackup | ||
metadata: | ||
name: metadatadb-backups | ||
namespace: archived | ||
spec: | ||
schedule: "0 58 */9 * * *" | ||
backupOwnerReference: self | ||
cluster: | ||
name: metadatadb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: s3-blob-repository | ||
namespace: archived | ||
data: | ||
BLOB_S3_ENDPOINT: https://s3.example.com # (CHANGEME: s3 endpoint) | ||
BLOB_S3_BUCKET: "<CHANGEME: blob bucket>" | ||
BLOB_S3_CREATE_BUCKET: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: archived-migrator | ||
namespace: archived | ||
labels: | ||
app.kubernetes.io/name: archived-migrator | ||
app.kubernetes.io/app: archived-migrator | ||
spec: | ||
template: | ||
metadata: | ||
name: archived-migrator | ||
labels: | ||
app.kubernetes.io/name: archived-migrator | ||
app.kubernetes.io/app: archived-migrator | ||
spec: | ||
containers: | ||
- name: migrator | ||
image: ghcr.io/teran/archived/migrator:latest | ||
imagePullPolicy: Always | ||
env: | ||
- name: METADATA_DSN | ||
valueFrom: | ||
secretKeyRef: | ||
name: metadatadb-app | ||
key: uri | ||
- name: LOG_LEVEL | ||
value: "trace" | ||
restartPolicy: OnFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Kubernetes deployment example | ||
|
||
## Prerequisites | ||
|
||
* ingress-nginx | ||
* openebs with hostpath enabled for PVC | ||
* VictoriaMetrics or Prometheus operator for PodMonitors | ||
* CloudNativePG for PostgreSQL | ||
* External S3 service to store blobs | ||
|
||
## Deploy | ||
|
||
* Change all the fields marked as "CHANGEME" to appropriate values | ||
* `kubectl apply -f .` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: archived-exporter | ||
namespace: archived | ||
labels: | ||
app.kubernetes.io/name: archived-exporter | ||
app.kubernetes.io/app: archived-exporter | ||
spec: | ||
replicas: 1 | ||
strategy: | ||
type: RollingUpdate | ||
revisionHistoryLimit: 10 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: archived-exporter | ||
app.kubernetes.io/app: archived-exporter | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: archived-exporter | ||
app.kubernetes.io/app: archived-exporter | ||
spec: | ||
affinity: | ||
podAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- key: app.kubernetes.io/app | ||
operator: In | ||
values: | ||
- archived-exporter | ||
topologyKey: "kubernetes.io/node" | ||
terminationGracePeriodSeconds: 30 | ||
containers: | ||
- name: exporter | ||
image: ghcr.io/teran/archived/exporter:latest | ||
imagePullPolicy: Always | ||
env: | ||
- name: METADATA_DSN | ||
valueFrom: | ||
secretKeyRef: | ||
name: metadata-database-ro | ||
key: METADATA_DSN_RO | ||
- name: LOG_LEVEL | ||
value: "trace" | ||
ports: | ||
- name: metrics | ||
containerPort: 8081 | ||
protocol: TCP | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 128Mi | ||
limits: | ||
memory: 1Gi | ||
readinessProbe: | ||
httpGet: | ||
path: /metrics | ||
port: metrics | ||
timeoutSeconds: 1 | ||
livenessProbe: | ||
httpGet: | ||
path: /metrics | ||
port: metrics | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
readOnlyRootFilesystem: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: archived-gc | ||
namespace: archived | ||
labels: | ||
app.kubernetes.io/name: archived-gc | ||
app.kubernetes.io/app: archived-gc | ||
spec: | ||
schedule: "48 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
metadata: | ||
name: archived-gc | ||
labels: | ||
app.kubernetes.io/name: archived-gc | ||
app.kubernetes.io/app: archived-gc | ||
spec: | ||
containers: | ||
- name: gc | ||
image: ghcr.io/teran/archived/gc:latest | ||
imagePullPolicy: Always | ||
env: | ||
- name: METADATA_DSN | ||
valueFrom: | ||
secretKeyRef: | ||
name: metadatadb-app | ||
key: uri | ||
- name: LOG_LEVEL | ||
value: "trace" | ||
- name: DRY_RUN | ||
value: "false" | ||
restartPolicy: OnFailure |
Oops, something went wrong.