Code Monkey home page Code Monkey logo

Comments (6)

brendandburns avatar brendandburns commented on June 30, 2024

How are you passing the token through to this client?

from csharp.

althunibat avatar althunibat commented on June 30, 2024

token is extracted from aspnet core httpcontext.
below snippet show how the client is initialized
var config = new KubernetesClientConfiguration { // Set your Kubernetes API server endpoint Host = "<cluster-url>", // Set other configuration options as needed SslCaCerts = new X509Certificate2Collection(new[] { new X509Certificate2(Encoding.UTF8.GetBytes( "<CA-CERT>")), }), AccessToken = "<access-token>" }; var client = new Kubernetes(config);

from csharp.

tg123 avatar tg123 commented on June 30, 2024

by setting accesstoken, client will send http request with http header Bearer <token>
you mean server side rejected your token?

from csharp.

althunibat avatar althunibat commented on June 30, 2024

Yes, the token was rejected as an invalid token appears in cluster logs(k3s) and the api call retuned 401.

I configured the kubectl oidc login plugin and the aspnet core app to use the same oidc client config on keycloak.

I'll try to setup github repo to share the poc code.

from csharp.

brendandburns avatar brendandburns commented on June 30, 2024

Easiest thing to do if you can is to try to export this as a YAML kubeconfig.

If kubectl ... with that kubeconfig file works, and this client doesn't work, then it's definitely a bug in this client.

If kubectl ... doesn't work, it's likely an issue with the token.

from csharp.

althunibat avatar althunibat commented on June 30, 2024

It was related to the token, it worked when the audience is correctly set, although it works with oidc login without audience.

from csharp.

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.