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