Skip to content

Simple docker container that can be used to initialize a postgresql database for a kubernetes service.

Notifications You must be signed in to change notification settings

mondata-dev/postgres-db-init

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

postgres-db-init

Simple docker container that can be used to initialize a postgresql database for a kubernetes service.

Example Usage

  initContainers:
    - name: init-db
      image: mondata/postgres-db-init
      imagePullPolicy: Always
      envFrom:
        - configMapRef:
            name: db-configmap
      env:
        - name: PGADMINPASSWORD
          valueFrom:
            secretKeyRef:
              name: postgresql-secret
              key: postgresql-password
        - name: PGUSER
          value: newuser
        - name: PGPASSWORD
          value: newsecret
        - name: PGDATABASE
          value: yourdb

This assumes the following kubernetes resources:

apiVersion: v1
kind: Secret
metadata:
  name: postgresql-secret
type: Opaque
stringData:
  postgresql-password: geheim
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: db-configmap
data:
  PGADMINUSER: postgres
  PGHOST:      example.com
  PGPORT:      5432

Build & Deploy

docker build -t mondata/postgres-db-init:VERSION .
docker push mondata/postgres-db-init:VERSION
git tag -a VERSION
git push --follow-tags

About

Simple docker container that can be used to initialize a postgresql database for a kubernetes service.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published