Giter Site home page Giter Site logo

Comments (5)

nabadger avatar nabadger commented on May 21, 2024 2

Yep, ran into the same thing when I was checking this earlier ;)

from dex-k8s-authenticator.

AlexMorreale avatar AlexMorreale commented on May 21, 2024

Looks like the code in the PR for that change only happens when you dont specify and a config file?

Correct me if i am wrong here.

from dex-k8s-authenticator.

nabadger avatar nabadger commented on May 21, 2024

@AlexMorreale thanks for feedback :)

The latest image should support this but there's a limitation in the Helm template at the moment as it doesn't let you pass in env to the podspec (I'll create an issue to track/add this as it's simple enough).

If you're rolling your own manifests, here's how you can do it.

dex-k8s-authenticator config:

listen: http://0.0.0.0:5555
debug: false
clusters:
- client_id: my-cluster
  client_secret: ${CLIENT_SECRET}
  description: minikube
  issuer: http://dex.minikube.test
  k8s_ca_uri: http://ca.example.com
  k8s_master_uri: http://my-cluster.example.com
  name: my-cluster
  redirect_uri: http://auth.minikube.test/callback/my-cluster

kubernetes secret:

apiVersion: v1
data:
  client_secret: <base64 encoded secret>
kind: Secret
metadata:
  name: dex-auth-secrets
  namespace: default
type: Opaque

pod-spec

  ...
  spec:
      containers:
      - args:
        - --config
        - config.yaml
        env:
        - name: CLIENT_SECRET
          valueFrom:
            secretKeyRef:
              key: client_secret
              name: dex-auth-secrets
...

So basically, just use ${SOME_VAR} in your configmap for any setting, and the application will perform a lookup at runtime to see if that value exists in your environ, if it does it will use it - the environ can just be populated by k8s secrets.

from dex-k8s-authenticator.

AlexMorreale avatar AlexMorreale commented on May 21, 2024

luckily i am rolling my own manifests(gives us more flexibility and allows us to use traefik as our ingress infront of them)

I actually tried something exactly this and im getting:

Failed to get token: oauth2: cannot fetch token: 401 Unauthorized
Response: {"error":"invalid_client","error_description":"Invalid client credentials."}

when i return from dex to dex-k8s-authenticator

from dex-k8s-authenticator.

AlexMorreale avatar AlexMorreale commented on May 21, 2024

nvm i figured it out it was kubernetes secret issue when base64 encoding for env vars the kubernetes docs recommand echo -n over echo for piping into base64.

bad:

alex@omega :: ~/ezcater/ ➜  echo "alex-testing" | base64            
YWxleC10ZXN0aW5nCg==

good:

alex@omega :: ~/ezcater/ ➜  echo -n "alex-testing" | base64            
YWxleC10ZXN0aW5n

Really sorry for the hassle. Left the long comment to help others in the future.

from dex-k8s-authenticator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.