https://dagster.io/ logo
#ask-community
Title
# ask-community
a

Archie Kennedy

08/29/2022, 10:26 AM
Hello everyone. I have a Dagster Cloud hybrid deployment on K8s (EKS) - I'm trying to inject a Kubernetes Secret into the agent pod as an environment variable but not having any luck. This is my code location (it's not valid, but it shows what I'm trying to achieve):
Copy code
location_name: my_pipeline
image: ************.<http://dkr.ecr.us-east-1.amazonaws.com/my_pipeline:latest|dkr.ecr.us-east-1.amazonaws.com/my_pipeline:latest>
code_source:
  package_name: my_pipeline
container_context:
  k8s:
    env_secrets:
      - secretRef:
        name: database-jwt
        key: token
I managed to make this work with a code location config like:
Copy code
location_name: my_pipeline
image: ***************.<http://dkr.ecr.us-east-1.amazonaws.com/my_pipeline:latest|dkr.ecr.us-east-1.amazonaws.com/my_pipeline:latest>
code_source:
  package_name: my_pipeline
container_context:
  k8s:
    env_secrets:
      - database-jwt
Which adds each key (e.g.:
token
) as an environment variable inside the runner pod. I think the documentation should be updated with a simple example. It currently links to a broken anchor tag in kubernetes docs that doesn't really help. See: https://docs.dagster.io/_apidocs/libraries/dagster-k8s#apis And another that mentions k8s Secrets in passing: https://docs.dagster.io/dagster-cloud/developing-testing/code-locations#adding-code-locations
j

jamie

08/29/2022, 4:16 PM
glad you fixed this! making an issue to update the docs
@Dagster Bot issue update secret management example in K8s docs
❤️ 1
d

Dagster Bot

08/29/2022, 4:17 PM