Closed wadkar closed 3 years ago
Can you please suggest ways to debug, or tell me how to disable the autohide for kubecontext?
You can disable auto-hide by removing POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND
from your config. See https://github.com/romkatv/powerlevel10k#why-some-prompt-segments-appear-and-disappear-as-im-typing.
If this will actually help, it means some other plugin you are using is interfering with powerlevel10k. Try disabling plugins one by one to find the culprit.
If removing POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND
doesn't help, please post the output of the following command:
whence kubectl && kubectl config view -o=yaml
Closing due to inactivity.
My apologies for not responding earlier. While I was unable to deduce which plugin is causing the problem, I can confirm that unsetting the POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND
variable sometimes work. I use kubectx
and kubens
to switch context and namespace. Another potential source of problem could be that the K8s ApiServer is an AWS EKS Server, and I need saml2aws
to access it. The SAML auth tokens expire every few hours and kubectl
commands fail without the auth token.
I can see the context again after successfully auth'ing with saml2aws
and selecting context+namespace using kubectx && kubens
. Interestingly enough, only a different context gets shown in the prompt and not the one on which I was working.
If you figure out a way to reproduce this reliably (in a way that I can do on my machine), please open a new issue.
Sure, I suspect it's got to do with saml2aws
and how the user
section of my ~/.kube/config
has:
- name: arn:aws:eks:us-east-1:1234567890:cluster/k8s-test
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- --region
- us-east-1
- eks
- get-token
- --cluster-name
- k8s-test
command: aws
env: null
Would you happen to have any working AWS+EKS clusters with saml2aws for auth?
I think it'll be rather difficult to reproduce without such a specific use case.
Powerlevel10k gets all info from the output of kubectl config view -o=yaml
. Does this call fail when you are not authenticated? All it's supposed to do is print your local config. If on your system it doesn't work, can you figure out how to force kubectl
to print its config without network I/O of any kind?
Ah, then maybe it's the asdf
which is causing the problem! I have just set asdf global kubectl 1.17.17
so kubectl
will work from any dir. That should ensure kubectl config view -o=yaml
will always return something sensible instead of:
❯ kubectl
No version set for command kubectl
Consider adding one of the following versions in your config file at
kubectl 1.19.3
kubectl 1.16.13
kubectl 1.13.0
kubectl 1.17.13
kubectl 1.17.17
Now any new shell shows the context in the prompt as soon as I type kubectl
(or even kb
which is alias
ed to kubectl
in my setup).
I think it should be safe to close this issue. I will reopen another if the problem persist.
Edit: No, the kubectl config view -o yaml
does not fail while not authenticated with saml2aws
to AWS/EKS.
Thanks again for your help and amazing p10k
work!
Thanks for updating the issue. I'm glad this is resolved.
Edit: No, the
kubectl config view -o yaml
does not fail while not authenticated withsaml2aws
to AWS/EKS.
Good to know. This is the expected behavior.
Hey, thanks a lot for
p10k
.I am trying to debug why
kubecontext
is not showing up whenkubectl
is in the command buffer. I have gone through #318 and have some basic idea of how it works. I looked at thep10k help display
and then:So it's hidden (by default). It used to show up earlier as soon as I typed
kubectl
but it doesn't show up anymore.Of course, I did a
p10k configure
to reconfigure p10k (with my favorite wizard options).I also see that
❯ echo $POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND
returnskubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile
. I am onpowerlevel10k-v1.14.6@d26bdcd6
usingprezto
's prompt module.Can you please suggest ways to debug, or tell me how to disable the autohide for kubecontext?
Let me know if you want the
~/.p10k.zsh
. I have instant-prompt enabled FWIW.