Welcome to the Linux Foundation Forum!

Chapter 12: Deploying "db" App

Options

As a follow-on to this post, for the "db" app to operate correctly in the Kubernetes environment variables need to be added to the "db" workload.

spec:
  containers:
  - env:
    - name: POSTGRES_HOST_AUTH_METHOD
      value: trust
    image: postgres:9.4
    imagePullPolicy: IfNotPresent
    name: postgres-1

This can be added by editing the deployment details in YAML.

Comments

  • cjmills
    cjmills Posts: 10
    edited November 2020
    Options

    Another way to make the change is add the environment variable when creating the deployment. For me, this worked as the vote application recorded votes; my initial code above (based on this) did not have the expected result.

    The code generated by the dash board when establishing the environment instead looks like this:

    spec:
      containers:
      - env:
        - name: POSTGRES_HOST_AUTH_METHOD
          valueFrom:
            configMapKeyRef:
              key: POSTGRES_HOST_AUTH_METHOD
              name: db-config-dllr
        image: postgres:9.4
        imagePullPolicy: IfNotPresent
        name: postgres-1
    
  • gouravshah
    Options

    @cjmills thank you for updating this. Yes, db needs the environment variable as you described to either disable the auth ( enable trust) or to actually provide the password. I am updating the instructions as well as videos accordingly.

Categories

Upcoming Training