Postgres DB密码未在Kubernetes脚本中设置

时间:2016-02-18 05:31:02

标签: postgresql docker kubernetes

出于某种原因,使用以下kubernetes脚本没有使用密码锁定postgres实例。

apiVersion: v1
kind: ReplicationController
metadata:
    name: postgres
    labels:
        name: postgres
spec:
    replicas: 1
    template:
      metadata:
        labels:
          name: postgres
      spec:
        containers:
          - resources:
            image: postgres:9.4
            name: postgres
            env:
              - name: DB_PASS
                value: password
              - name: PGDATA
                value: /var/lib/postgresql/data/pgdata
            ports:
              - containerPort: 5432
                name: postgres
            volumeMounts:
              - mountPath: /var/lib/postgresql/data
                name: postgres-persistent-storage
        volumes:
          - name: postgres-persistent-storage
            gcePersistentDisk:
              pdName: postgres-disk
              fsType: ext4

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

根据postgres图像的docker hub documentation,您应该使用环境变量POSTGRES_PASSWORD而不是DB_PASSWORD