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

Sean Han

02/13/2023, 6:07 PM
Is it possible to set an optional env variable for k8s in
dagster_cloud.yaml
? I tried following but it shows error
Copy code
container_context:
      k8s:
        env_secrets:
          - secretRef:
            name: some-secrets-key
            optional: true
The error is
You can only specify a single field at path root:container_context:k8s:env_secrets[1]. You specified ['name', 'optional', 'secretRef']. The available fields are ['env']
d

daniel

02/13/2023, 6:35 PM
Hey Sean - env_secrets is a list of Strings but I would expect this to work:
Copy code
container_context:
      k8s:
        run_k8s_config:
          container_config:
            env_from:
              - secret_ref:
                  name: some-secrets-key
                  optional: true
If you want to access it in your user code servers as well (e..g in sensor or when loading your jobs) you might have to put the same config in server_k8s_config alongside run_k8s_config as well
s

Sean Han

02/13/2023, 6:59 PM
sounds good! Let me test it out
Looks like it is working, thanks a lot!
19 Views