github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/applications/postgresql/postgresql-manifest.yaml (about) 1 --- 2 apiVersion: v1 3 kind: Namespace 4 metadata: 5 name: postgresql-system 6 labels: 7 app.kubernetes.io/name: postgresql 8 app.kubernetes.io/instance: my-postgresql 9 --- 10 # Source: postgresql/templates/secrets.yaml 11 apiVersion: v1 12 kind: Secret 13 metadata: 14 name: my-postgresql 15 labels: 16 app.kubernetes.io/name: postgresql 17 app.kubernetes.io/instance: my-postgresql 18 namespace: postgresql-system 19 type: Opaque 20 data: 21 postgresql-password: "UWxHNUp1THE0Sw==" 22 postgresql-replication-password: "cmVwbF9wYXNzd29yZA==" 23 --- 24 # Source: postgresql/templates/svc-headless.yaml 25 apiVersion: v1 26 kind: Service 27 metadata: 28 name: my-postgresql-headless 29 labels: 30 app.kubernetes.io/name: postgresql 31 32 app.kubernetes.io/instance: my-postgresql 33 34 # Use this annotation in addition to the actual publishNotReadyAddresses 35 # field below because the annotation will stop being respected soon but the 36 # field is broken in some versions of Kubernetes: 37 # https://github.com/kubernetes/kubernetes/issues/58662 38 service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" 39 namespace: postgresql-system 40 spec: 41 type: ClusterIP 42 clusterIP: None 43 # We want all pods in the StatefulSet to have their addresses published for 44 # the sake of the other Postgresql pods even before they're ready, since they 45 # have to be able to talk to each other in order to become ready. 46 publishNotReadyAddresses: true 47 ports: 48 - name: tcp-postgresql 49 port: 5432 50 targetPort: tcp-postgresql 51 selector: 52 app.kubernetes.io/name: postgresql 53 app.kubernetes.io/instance: my-postgresql 54 --- 55 # Source: postgresql/templates/svc-read.yaml 56 apiVersion: v1 57 kind: Service 58 metadata: 59 name: my-postgresql-read 60 labels: 61 app.kubernetes.io/name: postgresql 62 app.kubernetes.io/instance: my-postgresql 63 namespace: postgresql-system 64 spec: 65 type: ClusterIP 66 ports: 67 - name: tcp-postgresql 68 port: 5432 69 targetPort: tcp-postgresql 70 selector: 71 app.kubernetes.io/name: postgresql 72 app.kubernetes.io/instance: my-postgresql 73 role: read 74 --- 75 # Source: postgresql/templates/svc.yaml 76 apiVersion: v1 77 kind: Service 78 metadata: 79 name: my-postgresql 80 labels: 81 app.kubernetes.io/name: postgresql 82 app.kubernetes.io/instance: my-postgresql 83 namespace: postgresql-system 84 spec: 85 type: ClusterIP 86 ports: 87 - name: tcp-postgresql 88 port: 5432 89 targetPort: tcp-postgresql 90 selector: 91 app.kubernetes.io/name: postgresql 92 app.kubernetes.io/instance: my-postgresql 93 role: primary 94 --- 95 # Source: postgresql/templates/statefulset-readreplicas.yaml 96 apiVersion: apps/v1 97 kind: StatefulSet 98 metadata: 99 name: "my-postgresql-read" 100 labels: 101 app.kubernetes.io/name: postgresql 102 app.kubernetes.io/instance: my-postgresql 103 app.kubernetes.io/component: read 104 namespace: postgresql-system 105 spec: 106 serviceName: my-postgresql-headless 107 replicas: 1 108 selector: 109 matchLabels: 110 app.kubernetes.io/name: postgresql 111 app.kubernetes.io/instance: my-postgresql 112 role: read 113 template: 114 metadata: 115 name: my-postgresql 116 labels: 117 app.kubernetes.io/name: postgresql 118 app.kubernetes.io/instance: my-postgresql 119 app.kubernetes.io/component: read 120 role: read 121 spec: 122 affinity: 123 podAntiAffinity: 124 preferredDuringSchedulingIgnoredDuringExecution: 125 - podAffinityTerm: 126 labelSelector: 127 matchLabels: 128 app.kubernetes.io/name: postgresql 129 app.kubernetes.io/instance: my-postgresql 130 app.kubernetes.io/component: read 131 namespaces: 132 - "postgresql-system" 133 topologyKey: kubernetes.io/hostname 134 weight: 1 135 securityContext: 136 fsGroup: 1001 137 automountServiceAccountToken: false 138 containers: 139 - name: my-postgresql 140 image: docker.io/bitnami/postgresql:11.12.0-debian-10-r70 141 imagePullPolicy: "IfNotPresent" 142 resources: 143 requests: 144 cpu: 250m 145 memory: 256Mi 146 securityContext: 147 runAsUser: 1001 148 env: 149 - name: BITNAMI_DEBUG 150 value: "false" 151 - name: POSTGRESQL_VOLUME_DIR 152 value: "/bitnami/postgresql" 153 - name: POSTGRESQL_PORT_NUMBER 154 value: "5432" 155 - name: PGDATA 156 value: "/bitnami/postgresql/data" 157 - name: POSTGRES_REPLICATION_MODE 158 value: "slave" 159 - name: POSTGRES_REPLICATION_USER 160 value: "repl_user" 161 - name: POSTGRES_REPLICATION_PASSWORD 162 valueFrom: 163 secretKeyRef: 164 name: my-postgresql 165 key: postgresql-replication-password 166 - name: POSTGRES_CLUSTER_APP_NAME 167 value: my_application 168 - name: POSTGRES_MASTER_HOST 169 value: my-postgresql 170 - name: POSTGRES_MASTER_PORT_NUMBER 171 value: "5432" 172 - name: POSTGRES_PASSWORD 173 valueFrom: 174 secretKeyRef: 175 name: my-postgresql 176 key: postgresql-password 177 - name: POSTGRESQL_ENABLE_TLS 178 value: "no" 179 - name: POSTGRESQL_LOG_HOSTNAME 180 value: "false" 181 - name: POSTGRESQL_LOG_CONNECTIONS 182 value: "false" 183 - name: POSTGRESQL_LOG_DISCONNECTIONS 184 value: "false" 185 - name: POSTGRESQL_PGAUDIT_LOG_CATALOG 186 value: "off" 187 - name: POSTGRESQL_CLIENT_MIN_MESSAGES 188 value: "error" 189 - name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES 190 value: "pgaudit" 191 ports: 192 - name: tcp-postgresql 193 containerPort: 5432 194 livenessProbe: 195 exec: 196 command: 197 - /bin/sh 198 - -c 199 - exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432 200 initialDelaySeconds: 30 201 periodSeconds: 10 202 timeoutSeconds: 5 203 successThreshold: 1 204 failureThreshold: 6 205 readinessProbe: 206 exec: 207 command: 208 - /bin/sh 209 - -c 210 - -e 211 - | 212 exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432 213 [ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ] 214 initialDelaySeconds: 5 215 periodSeconds: 10 216 timeoutSeconds: 5 217 successThreshold: 1 218 failureThreshold: 6 219 volumeMounts: 220 - name: dshm 221 mountPath: /dev/shm 222 - name: data 223 mountPath: /bitnami/postgresql 224 225 volumes: 226 - name: dshm 227 emptyDir: 228 medium: Memory 229 sizeLimit: 1Gi 230 updateStrategy: 231 type: RollingUpdate 232 volumeClaimTemplates: 233 - metadata: 234 name: data 235 spec: 236 accessModes: 237 - "ReadWriteOnce" 238 resources: 239 requests: 240 storage: "50Gi" 241 storageClassName: local-hostpath 242 --- 243 # Source: postgresql/templates/statefulset.yaml 244 apiVersion: apps/v1 245 kind: StatefulSet 246 metadata: 247 name: my-postgresql-postgresql-primary 248 labels: 249 app.kubernetes.io/name: postgresql 250 app.kubernetes.io/instance: my-postgresql 251 app.kubernetes.io/component: primary 252 namespace: postgresql-system 253 spec: 254 serviceName: my-postgresql-headless 255 replicas: 1 256 updateStrategy: 257 type: RollingUpdate 258 selector: 259 matchLabels: 260 app.kubernetes.io/name: postgresql 261 app.kubernetes.io/instance: my-postgresql 262 role: primary 263 template: 264 metadata: 265 name: my-postgresql 266 labels: 267 app.kubernetes.io/name: postgresql 268 app.kubernetes.io/instance: my-postgresql 269 role: primary 270 app.kubernetes.io/component: primary 271 spec: 272 affinity: 273 podAntiAffinity: 274 preferredDuringSchedulingIgnoredDuringExecution: 275 - podAffinityTerm: 276 labelSelector: 277 matchLabels: 278 app.kubernetes.io/name: postgresql 279 app.kubernetes.io/instance: my-postgresql 280 app.kubernetes.io/component: primary 281 namespaces: 282 - "postgresql-system" 283 topologyKey: kubernetes.io/hostname 284 weight: 1 285 securityContext: 286 fsGroup: 1001 287 automountServiceAccountToken: false 288 containers: 289 - name: my-postgresql 290 image: docker.io/bitnami/postgresql:11.12.0-debian-10-r70 291 imagePullPolicy: "IfNotPresent" 292 resources: 293 requests: 294 cpu: 250m 295 memory: 256Mi 296 securityContext: 297 runAsUser: 1001 298 env: 299 - name: BITNAMI_DEBUG 300 value: "false" 301 - name: POSTGRESQL_PORT_NUMBER 302 value: "5432" 303 - name: POSTGRESQL_VOLUME_DIR 304 value: "/bitnami/postgresql" 305 - name: PGDATA 306 value: "/bitnami/postgresql/data" 307 - name: POSTGRES_REPLICATION_MODE 308 value: "master" 309 - name: POSTGRES_REPLICATION_USER 310 value: "repl_user" 311 - name: POSTGRES_REPLICATION_PASSWORD 312 valueFrom: 313 secretKeyRef: 314 name: my-postgresql 315 key: postgresql-replication-password 316 - name: POSTGRES_CLUSTER_APP_NAME 317 value: my_application 318 - name: POSTGRES_USER 319 value: "postgres" 320 - name: POSTGRES_PASSWORD 321 valueFrom: 322 secretKeyRef: 323 name: my-postgresql 324 key: postgresql-password 325 - name: POSTGRESQL_ENABLE_LDAP 326 value: "no" 327 - name: POSTGRESQL_ENABLE_TLS 328 value: "no" 329 - name: POSTGRESQL_LOG_HOSTNAME 330 value: "false" 331 - name: POSTGRESQL_LOG_CONNECTIONS 332 value: "false" 333 - name: POSTGRESQL_LOG_DISCONNECTIONS 334 value: "false" 335 - name: POSTGRESQL_PGAUDIT_LOG_CATALOG 336 value: "off" 337 - name: POSTGRESQL_CLIENT_MIN_MESSAGES 338 value: "error" 339 - name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES 340 value: "pgaudit" 341 ports: 342 - name: tcp-postgresql 343 containerPort: 5432 344 livenessProbe: 345 exec: 346 command: 347 - /bin/sh 348 - -c 349 - exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432 350 initialDelaySeconds: 30 351 periodSeconds: 10 352 timeoutSeconds: 5 353 successThreshold: 1 354 failureThreshold: 6 355 readinessProbe: 356 exec: 357 command: 358 - /bin/sh 359 - -c 360 - -e 361 - | 362 exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432 363 [ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ] 364 initialDelaySeconds: 5 365 periodSeconds: 10 366 timeoutSeconds: 5 367 successThreshold: 1 368 failureThreshold: 6 369 volumeMounts: 370 - name: dshm 371 mountPath: /dev/shm 372 - name: data 373 mountPath: /bitnami/postgresql 374 volumes: 375 - name: dshm 376 emptyDir: 377 medium: Memory 378 volumeClaimTemplates: 379 - metadata: 380 name: data 381 spec: 382 accessModes: 383 - "ReadWriteOnce" 384 resources: 385 requests: 386 storage: "50Gi" 387 storageClassName: local-hostpath