most-river-7586
12/04/2023, 9:46 PMselfservice.methods.oidc.config.providers
list for the Kratos helm chart?
As mentioned here:
https://www.ory.sh/docs/self-hosted/kratos/configuration/oidc#environment-variables
The only option seems to be exporting the whole config via:
export SELFSERVICE_METHODS_OIDC_CONFIG_PROVIDERS='[<bunch of json>]'
which isn't recommended in the docs due to the complexity.
Is there a recommended alternative? If I can't override a secret that's nested within that list, and overriding the entire list isn't recommended, I wonder if there's a more reasonable option 🤔astonishing-morning-18498
12/05/2023, 3:25 PMsecret.enabled: true
flag in your helm values.yml? This should wrap your entire config in a secretmost-river-7586
12/05/2023, 6:32 PMsecret.enabled
here: https://github.com/ory/k8s/blob/master/helm/charts/kratos/values.yaml#L60-L65
and it only seems to create a secret with the secretsDefault
, secretsCookie
, etc, attributes:
https://github.com/ory/k8s/blob/master/helm/charts/kratos/templates/secrets.yaml
which mounts them onto the kratos
deployment as env vars: https://github.com/ory/k8s/blob/master/helm/charts/kratos/templates/deployment-kratos.yaml#L153-L170
but it doesn't seem to manage any of the config itself... unless I'm missing something?astonishing-morning-18498
12/05/2023, 6:38 PM- name: SECRETS_DEFAULT
valueFrom:
secretKeyRef:
key: secretsDefault
name: kratos
optional: true
- name: SECRETS_COOKIE
valueFrom:
secretKeyRef:
key: secretsCookie
name: kratos
optional: true
- name: SECRETS_CIPHER
valueFrom:
secretKeyRef:
key: secretsCipher
name: kratos
optional: true
astonishing-morning-18498
12/05/2023, 6:40 PMfile:///etc/config/...
schemeastonishing-morning-18498
12/05/2023, 6:41 PMenough-yak-81379
12/06/2023, 10:36 AMmost-river-7586
12/06/2023, 7:33 PMkratos.config
in the helm chart's values.yaml? https://github.com/ory/k8s/blob/2dd8b03e7963bbb8664903a3ca1b9a2bfcac6e39/helm/charts/kratos/values.yaml#L179
Would I move all that config into a secret, and mount that secret as a volume?
If so, then it sounds like I'd add something like this in my Kratos deployment manifest:
spec:
template:
spec:
containers:
volumeMounts:
- name: kratos-config
mountPath: /etc/config/kratos/kratos.yml
volumes:
- name: kratos-config
secret:
secretName: kratos-config-secret
items:
- key: config.yaml
path: config.yaml
But if I'm managing the whole config inside a single secret, how would I codify that as code?
Seems like it would be hard to separate the configuration parts from the confidential parts.
For context, my goal is to manage my config in a git repo, while eliding confidential configs such as client_id
and client_secret
like so:
kratos:
config:
version: v1.0.0
... lots more config...
selfservice:
methods:
oidc:
enabled: true
providers:
- id: okta-test
provider: generic
client_id: ${CLIENT_ID}
client_secret: ${CLIENT_SECRET}
issuer_url: <https://login.example.com>
scope:
- openid
- profile
- email
enough-yak-81379
12/07/2023, 7:14 AMyaml
kratos:
config:
version: v1.0.0
... lots more config...
selfservice:
methods:
oidc:
enabled: true
providers:
- id: okta-test
provider: generic
client_id: FOO
client_secret: <file://path/to/mounted/secret>
issuer_url: <https://login.example.com>
scope:
- openid
- profile
- email
And use volumemounts to mount supply the secretenough-yak-81379
12/07/2023, 7:15 AMenough-yak-81379
12/07/2023, 7:16 AMyaml
kratos:
config:
version: v1.0.0
... lots more config...
selfservice:
methods:
oidc:
enabled: true
providers:
- id: okta-test
provider: generic
client_id: {{ .Values.customSecrets.foo.name }}
client_secret: {{ .Values.customSecrets.foo.value }}
issuer_url: <https://login.example.com>
scope:
- openid
- profile
- email
astonishing-morning-18498
12/07/2023, 3:01 PM<file://path/to/mount/secret>
like Demonsthere said.
If you manually created the secret, it would look like this:
apiVersion: v1
kind: Secret
metadata:
name: additional-kratos-secrets
type: <http://kubernetes.io/basic-auth|kubernetes.io/basic-auth>
stringData:
okta-client-id: my-client-id
okta-client-secret: my-client-secret
In your kratos config:
kratos:
selfservice:
methods:
oidc:
enabled: true
providers:
- id: okta-test
provider: generic
client_id: file:///etc/secrets/okta-client-id
client_secret: file:///etc/secrets/okta-client-secret
issuer_url: <https://login.example.com>
scope:
- openid
- profile
- email
In your Helm values.yaml:
deployment:
extraVolumes:
- name: additional-kratos-secrets
secret:
secretName: additional-kratos-secrets
extraVolumeMounts:
- name: additional-kratos-secrets
mountPath: /etc/secrets # folder to place secret file
subPath: okta-client-id # name of key in secret
readOnly: true
- name: additional-kratos-secrets
mountPath: /etc/secrets
subPath: okta-client-secret
readOnly: true
astonishing-morning-18498
12/07/2023, 3:01 PMmost-river-7586
12/07/2023, 6:21 PMaverage-iron-40995
12/27/2023, 10:37 AMmost-river-7586
01/02/2024, 9:27 AM<https://login.example.com/oauth2/v1/authorize?client_id=file:///etc/secrets/okta-client-id&>...
where Kratos seems to interpret the client_id
to be the literal string file:///etc/secrets/okta-client-id
.
Seems like the file://
clause is not supported? Any ideas on how I can get this working?
Additional details:
1. I'm using the helm chart version 0.37.0
and kratos version 1.0.0
.
2. These values are getting mounted correctly on the pod, because I can shell into the kratos
pod and run cat /etc/secrets/okta-client-id
, which returns the expected client id.
3. I tried using 2 slashes, and 3 slashes after file:
(ie: file:///etc/...
and <file://etc/>...
), and neither worksastonishing-morning-18498
10/23/2024, 11:06 PM