Database · PostgreSQL ·
[Kubernetes] Install CloudNativePG Using Helm Chart
PostgreSQL Helm Repo 추가 #
1helm repo add cnpg https://cloudnative-pg.github.io/charts1helm repo update자신의 환경에 맞게 values.yaml 파일 수정 #
1replicaCount: 1
2
3image:
4 repository: ghcr.io/cloudnative-pg/cloudnative-pg
5 pullPolicy: IfNotPresent
6 # -- Overrides the image tag whose default is the chart appVersion.
7 tag: ""
8
9imagePullSecrets: []
10nameOverride: ""
11fullnameOverride: ""
12namespaceOverride: ""
13
14hostNetwork: false
15
16...✂...
17
18# -- Nodeselector for the operator to be installed.
19nodeSelector: {}
20
21# -- Tolerations for the operator to be installed.
22tolerations: []
23
24# -- Affinity for the operator to be installed.
25affinity: {}
26
27...✂...Values 참고
Helm으로 Operator 설치 #
1helm install cnpg cnpg/cloudnative-pg --namespace [NAMESPACE NAME] -f values.yamlpostgresql 배포 #
1apiVersion: postgresql.cnpg.io/v1
2kind: Cluster
3metadata:
4 name: mycluster
5spec:
6 imageName: postgres:17.3
7 instances: 3 # 3대 파드 (Primary 1대, Standby 2대가 기본)
8 storage:
9 size: 3Gi
10 postgresql:
11 parameters:
12 max_worker_processes: "40"
13 timezone: "Asia/Seoul"
14 ssl_min_protocol_version: TLSv1.2
15 pg_hba:
16 - host all postgres all trust
17 primaryUpdateStrategy: unsupervised
18 enableSuperuserAccess: true
19 bootstrap:
20 initdb:
21 database: app
22 encoding: UTF8
23 localeCType: C
24 localeCollate: C
25 owner: appCluster Sample Yaml 참고
Cluster Sample Init DB Yaml 참고
Cluster Sample Init DB SQL Refs Yaml 참고
Advertisement