Coder Social home page Coder Social logo

Comments (21)

awm-achi avatar awm-achi commented on September 15, 2024 1

That worked! Helm and skupper now work as expected too, and now namespace seems to be sessions specific.

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

Hmm I suspect you want to use the method that changes the global state of your kubeconfig and not just the session?

Could you try with these aliases instead?

alias kubectx='kubesess default-context'
alias kubens='kubesess default-namespace'

Those should be in place replacement for kubectx and kubens

from kubesess.

awm-achi avatar awm-achi commented on September 15, 2024

Well I'd ideally like to retain separation between terminal sessions, I'm not looking to replicate kubectx and kubens, I just use those naming conventions for familiarity.

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

Oh my bad, the aliases threw me off.

So you want to have multiple sessions for the same context but different namespaces?

At the moment that isn't working :(, I have been thinking about implementing it and might do it if I come up with a good solution for it.

What exists today is that you can have one session that is using the base config and one session that uses the kubesess session, and those can be the same context but a different namespace, like this:
image
But every next kubesess change to the same context will overwrite the original one.

Just to double-check, the context per session is working as expected?

from kubesess.

awm-achi avatar awm-achi commented on September 15, 2024

the context per session works, except the set namespace for kubesess sessions don't work for tools like helm and skupper, they seem to work for kubectl though

from kubesess.

awm-achi avatar awm-achi commented on September 15, 2024

so if I do kubectl get pods, it will display the pods from the correct namespace, but if I helm upgrade, it will say release not found because it's trying to upgrade in a different namespace

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

I see, I'm making the wrong assumptions all the time here.

If that's the case then helm/skupper might be targeting the base file directly and not using the KUBECONFIG env?
Or if they do use the env, they might not support multiple paths there (kubectl merge)?

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

Looked up helm and it's supposed to use the KUBECONFIG env, also seems to support merge as well, at least from helm 3.
What helm version are you on?

from kubesess.

awm-achi avatar awm-achi commented on September 15, 2024

version.BuildInfo{Version:"v3.9.4", GitCommit:"dbc6d8e20fe1d58d50e6ed30f09a04a77e4c68db", GitTreeState:"clean", GoVersion:"go1.19"}

I'll have to confirm how skupper is getting the kubeconfig address

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

Tried replicating your issue with helm but not managing to do so.
Running helm install jaeger --generate-name installs to the current namespace:
image
Tried it on three different namespaces

Also tried the helm upgrade --install jaeger jaegertracing/jaeger command:
image

using version.BuildInfo{Version:"v3.9.2", GitCommit:"1addefbfe665c350f4daf868a9adc5600cc064fd", GitTreeState:"clean", GoVersion:"go1.17.12"}

from kubesess.

awm-achi avatar awm-achi commented on September 15, 2024

hmmm that's strange, I just tried again
❯ kubectl create ns test
namespace/test created
❯ kubens
· test
❯ helm install jaeger jaegertracing/jaeger
NAME: jaeger
LAST DEPLOYED: Sat Sep 17 12:59:18 2022
NAMESPACE: monitoring
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
###################################################################

IMPORTANT: Ensure that storage is explicitly configured

Default storage options are subject to change.

IMPORTANT: The use of .env: {...} is deprecated.

Please use .extraEnv: [] instead.

###################################################################

You can log into the Jaeger Query UI here:

export POD_NAME=$(kubectl get pods --namespace monitoring -l "app.kubernetes.io/instance=jaeger,app.kubernetes.io/component=query" -o jsonpath="{.items[0].metadata.name}")
echo http://127.0.0.1:8080/
kubectl port-forward --namespace monitoring $POD_NAME 8080:16686

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

@awm-achi Not sure if that did what you wanted it to do tbh, looks like you picked namespace test but it deployed to monitoring which I assume is set in your base kubeconfig file.

I think this compromise would work best for you:

alias kubectx='export KUBECONFIG=$(kubesess context)'
alias kubens='export KUBECONFIG=$(kubesess default-namespace)'

That will keep the context per session and make namespace choice more reliable.

I'll close this for now but don't hesitate to reopen if you think of something else!

from kubesess.

awm-achi avatar awm-achi commented on September 15, 2024

oh yes, sorry for the confusion, that is not what I wanted to happen, I just wanted to show what was happening on my end. I will use the default-namespace for now but I would like to be able to use session specific namespaces if possible, is there any other debugging steps I can try?

from kubesess.

awm-achi avatar awm-achi commented on September 15, 2024

Quick update, I tried to use default namespace, but now when I switch namespaces, it will also switch the context to whatever was last selected as context using the kubectx

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

Yeah you are correct, there is some unintentional behaviour with default-context, let me see if I can fix it right away

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

@awm-achi I think I fixed that, it's building at the moment but it should make default-namespace work better for you!
I'll add a to-do on making namespace per session for the same context work in the future, just need to come up with a good way of handling that.

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

@awm-achi Did the latest release work better?

from kubesess.

awm-achi avatar awm-achi commented on September 15, 2024

I upgraded through brew 1.2.8 and still have the same problem. If I have 2 clusters A and B, and namespaces 1 and 2, I have two sessions open on A and B 1 and 1, the if I switch B1 to B2, that session becomes A1 instead. (After kubectx has been run on both sessions first)

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

Oh right, forgot, we don't change the env var on default-namespace!

alias kubectx='export KUBECONFIG=$(kubesess context)'
alias kubens='kubesess default-namespace'

Could you change your alias to that?

from kubesess.

awm-achi avatar awm-achi commented on September 15, 2024

Oh I see, namespace isn't session specific if two sessions are using the same context. This is good for my use case though. Thanks!

from kubesess.

Ramilito avatar Ramilito commented on September 15, 2024

Sweet!
Yeah, it's a bit confusing, the thought is that you might want to change namespace just for a while but all new sessions should use the default one.

from kubesess.

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.