-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(manifests): Add a postgresql deployment manifest in third-party …
…folder (#9581)
- Loading branch information
Showing
7 changed files
with
101 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Build PostgreSQL yaml | ||
|
||
```bash | ||
# In this folder of manifests/kustomize/third-party/postgresql | ||
rm -rf build | ||
mkdir buidl | ||
kustomize build ./base -o build | ||
``` | ||
|
||
## Deploy PostgreSQL container | ||
|
||
```bash | ||
# In this folder of manifests/kustomize/third-party/postgresql | ||
kubectl apply -f build | ||
``` |
8 changes: 8 additions & 0 deletions
8
manifests/kustomize/third-party/postgresql/base/kustomization.yaml
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,8 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- pg-deployment.yaml | ||
- pg-pvc.yaml | ||
- pg-service.yaml | ||
- pg-secret.yaml | ||
- pg-serviceaccount.yaml |
42 changes: 42 additions & 0 deletions
42
manifests/kustomize/third-party/postgresql/base/pg-deployment.yaml
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,42 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: postgres-deployment | ||
labels: | ||
app: postgres | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: postgres | ||
template: | ||
metadata: | ||
labels: | ||
app: postgres | ||
spec: | ||
serviceAccountName: postgresql | ||
containers: | ||
- image: postgres:14.7-alpine3.17 | ||
name: postgres | ||
env: | ||
- name: POSTGRES_DB | ||
value: postgres | ||
- name: POSTGRES_USER | ||
value: user | ||
- name: POSTGRES_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: postgres-secret | ||
key: root_password | ||
- name: PGDATA | ||
value: /var/lib/postgresql/data/pgdata | ||
ports: | ||
- containerPort: 5432 | ||
name: postgres | ||
volumeMounts: | ||
- name: postgres-stateful-data | ||
mountPath: /var/lib/postgresql/data | ||
volumes: | ||
- name: postgres-stateful-data | ||
persistentVolumeClaim: | ||
claimName: postgres-pvc |
12 changes: 12 additions & 0 deletions
12
manifests/kustomize/third-party/postgresql/base/pg-pvc.yaml
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,12 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: postgres-pvc | ||
labels: | ||
app: postgres | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 20Gi |
7 changes: 7 additions & 0 deletions
7
manifests/kustomize/third-party/postgresql/base/pg-secret.yaml
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: Secret | ||
metadata: | ||
name: postgres-secret | ||
type: Opaque | ||
data: | ||
root_password: password |
12 changes: 12 additions & 0 deletions
12
manifests/kustomize/third-party/postgresql/base/pg-service.yaml
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,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: postgres-service | ||
labels: | ||
app: postgres | ||
spec: | ||
ports: | ||
- port: 5432 | ||
type: LoadBalancer | ||
selector: | ||
app: postgres |
5 changes: 5 additions & 0 deletions
5
manifests/kustomize/third-party/postgresql/base/pg-serviceaccount.yaml
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,5 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: postgresql | ||
|