TLDR
When you switch between clusters, k9s "remembers" the aliases/api-resources from your previous cluster. This is bad, since some aliases from a previous cluster can override the proper aliases from your current cluster.
I ran into this with two apiversions of the same custom resource, one older and one newer. However, it happens with any api resources/aliases.
For example, Flux uses the newer kustomize.toolkit.fluxcd.io/v1/kustomizations resource with the shortname ks on one cluster. If you switch to another cluster that uses the kustomize.toolkit.fluxcd.io/v1beta2/kustomizations resource, :ks will sometimes try to find kustomize.toolkit.fluxcd.io/v1 and fail with the message no resource meta defined for "kustomize.toolkit.fluxcd.io/v1/kustomizations".
To Reproduce
Steps to reproduce the behavior:
Install a CRD on cluster 1
Do not install it on cluster 2
Open k9s on cluster 1
Change to cluster 2
You can still see the command to show the cluster 1 CRD
The :ks command will only work on one cluster, the specific cluster seems to be inconsistent
Historical Documents
k9s.log for an example where k9s decided that ks mapped to kustomize.toolkit.fluxcd.io/v1beta1/kustomizations and where I was still able to try and find kuma.io/v1alpha1/zoneegresses from my previous cluster context.
10:24AM INF 🐶 K9s starting up...
10:24AM INF ✅ Kubernetes connectivity
10:24AM WRN CustomView watcher failed error="lstat /Users/dylanpenka/Library/Application Support/k9s/views.yaml: no such file or directory"
10:24AM WRN CustomView watcher failed error="lstat /Users/dylanpenka/Library/Application Support/k9s/views.yaml: no such file or directory"
10:24AM ERR Retry failed error="context canceled"
10:24AM ERR Component init failed for "" error="no resource meta defined for \"kustomize.toolkit.fluxcd.io/v1beta1/kustomizations\""
10:24AM ERR Watcher failed for kustomize.toolkit.fluxcd.io/v1/kustomizations -- the server could not find the requested resource (get kustomizations.kustomize.toolkit.fluxcd.io) error="the server could not find the requested resource (get kustomizations.kustomize.toolkit.fluxcd.io)"
10:24AM WRN CustomView watcher failed error="lstat /Users/dylanpenka/Library/Application Support/k9s/views.yaml: no such file or directory"
10:24AM ERR Component init failed for "" error="no resource meta defined for \"kustomize.toolkit.fluxcd.io/v1/kustomizations\""
10:26AM ERR Component init failed for "" error="no resource meta defined for \"clusterconfig.azure.com/v1alpha1/fluxconfigs\""
10:29AM WRN CustomView watcher failed error="lstat /Users/dylanpenka/Library/Application Support/k9s/views.yaml: no such file or directory"
10:29AM ERR Component init failed for "" error="no resource meta defined for \"kuma.io/v1alpha1/zoneegresses\""
Expected behavior
I should only have aliases defined for the context that I'm currently using. I should not "carry over" aliases from other contexts.
Screenshots
Before changing to the second cluster:
After changing to the second cluster
Changing back to the first cluster (note that ks maps to v1 and not the correct v1beta2)
Error message from the first cluster
Versions (please complete the following information):
Describe the bug
TLDR When you switch between clusters, k9s "remembers" the aliases/api-resources from your previous cluster. This is bad, since some aliases from a previous cluster can override the proper aliases from your current cluster.
I ran into this with two apiversions of the same custom resource, one older and one newer. However, it happens with any api resources/aliases.
For example, Flux uses the newer
kustomize.toolkit.fluxcd.io/v1/kustomizations
resource with the shortnameks
on one cluster. If you switch to another cluster that uses thekustomize.toolkit.fluxcd.io/v1beta2/kustomizations
resource,:ks
will sometimes try to findkustomize.toolkit.fluxcd.io/v1
and fail with the messageno resource meta defined for "kustomize.toolkit.fluxcd.io/v1/kustomizations"
.To Reproduce Steps to reproduce the behavior:
Reproduce my specific issue:
:ks
command will only work on one cluster, the specific cluster seems to be inconsistentHistorical Documents
k9s.log
for an example where k9s decided thatks
mapped tokustomize.toolkit.fluxcd.io/v1beta1/kustomizations
and where I was still able to try and findkuma.io/v1alpha1/zoneegresses
from my previous cluster context.Expected behavior I should only have aliases defined for the context that I'm currently using. I should not "carry over" aliases from other contexts.
Screenshots Before changing to the second cluster:
After changing to the second cluster
Changing back to the first cluster (note that
ks
maps tov1
and not the correctv1beta2
)Error message from the first cluster
Versions (please complete the following information):