Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get my clusters to appear #779

Open
creckord opened this issue Aug 2, 2024 · 10 comments · May be fixed by #781
Open

Cannot get my clusters to appear #779

creckord opened this issue Aug 2, 2024 · 10 comments · May be fixed by #781
Assignees
Milestone

Comments

@creckord
Copy link

creckord commented Aug 2, 2024

I have been using the Jetbrains Kubernetes plugin on and off for a while now, and have several clusters added in IntelliJ.

I wanted to give the Redhat Kubernetes plugin a shot, because really, the Jetbrains one is too clunky as my main k8s console (coming from OpenLens).

Unfortunately, all I got from the Redhat plugin was a long time of cluster resource refreshing, but at the end, the Kubernetes tool window just stayed empty. No errors in the logs either.

IntelliJ IDEA 2024.1.4 (Ultimate Edition) Build #IU-241.18034.62
Redhat Kubernetes Plugin 1.3.0
OpenJDK 64-Bit Server VM by JetBrains s.r.o. Runtime version: 17.0.11+1-b1207.24 amd64

@creckord
Copy link
Author

creckord commented Aug 2, 2024

Hm, actually, looking at a fresh log from a recently restarted IDEA, I get a whole bunch of these from the IntelliJ Kubernetes provider:

2024-08-02 20:43:38,680 [   5436]   INFO - #c.i.k.a.KubernetesApiProvider - Configuration refresh started
2024-08-02 20:43:38,951 [   5707]   WARN - #c.i.k.a.KubernetesApiProvider - Configuration not loaded: Context 'prod-gcp-star' not found in contexts list [], kubeconfig file: file://C:/Users/creckord/.kube/config
2024-08-02 20:43:38,953 [   5709]   INFO - #c.i.k.a.KubernetesApiProvider - Configuration loaded: ContextsConfiguration(contexts={kind-kind=Context(name=kind-kind, kubeConfigUrl=file://C:/Users/creckord/.kube/kind-k8s.yaml, originalNamespace=apicurio, clusterPath=null), microk8s=Context(name=microk8s, kubeConfigUrl=file://C:/Users/creckord/.kube/microk8s.yaml, originalNamespace=kubebox, clusterPath=null), prod-dc=Context(name=prod-dc, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-dc.yaml, originalNamespace=ars, clusterPath=null), prod-dc-back01=Context(name=prod-dc-back01, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-dc.yaml, originalNamespace=ars, clusterPath=null), dpa-analytics=Context(name=dpa-analytics, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-onprem-analytics.yaml, originalNamespace=star-spark-analytics, clusterPath=null), prod-onprem=Context(name=prod-onprem, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-onprem.yaml, originalNamespace=ermittlungsbericht-archiv, clusterPath=null), prod-gcp-common=Context(name=prod-gcp-common, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-gcp-common.yaml, originalNamespace=sentry, clusterPath=null), prod-gcp-star=Context(name=prod-gcp-star, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-gcp-star.yaml, originalNamespace=kafka, clusterPath=null), test-onprem-oracle=Context(name=test-onprem-oracle, kubeConfigUrl=file://C:/Users/creckord/.kube/test-onprem-oracle.yaml, originalNamespace=oracle-database-enterprise-edition, clusterPath=null), test-onprem=Context(name=test-onprem, kubeConfigUrl=file://C:/Users/creckord/.kube/test-onprem.yaml, originalNamespace=ars-selenium1, clusterPath=null)}, kubeConfig=KubeConfigEx(contexts=[{context={cluster=kind-kind, namespace=apicurio, user=kind-kind}, name=kind-kind}, {context={cluster=microk8s-cluster, namespace=kubebox, user=admin}, name=microk8s}, {context={cluster=prod-dc-back01, namespace=ars, user=arvato-back01}, name=prod-dc}, {context={cluster=prod-dc-back01, namespace=ars, user=arvato-back ...
2024-08-02 20:43:39,313 [   6069]   INFO - #c.i.k.a.KubernetesApiProvider - Configuration applied to executor
2024-08-02 20:43:39,353 [   6109]   INFO - #c.i.k.a.KubernetesApiProvider - Model added: KubernetesApiModel(currentContextObject=Context(name=dpa-analytics, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-onprem-analytics.yaml, originalNamespace=star-spark-analytics, clusterPath=null))
2024-08-02 20:43:39,354 [   6110]   INFO - #c.i.k.a.KubernetesApiProvider - Model added: KubernetesApiModel(currentContextObject=Context(name=microk8s, kubeConfigUrl=file://C:/Users/creckord/.kube/microk8s.yaml, originalNamespace=kubebox, clusterPath=null))
2024-08-02 20:43:39,354 [   6110]   INFO - #c.i.k.a.KubernetesApiProvider - Model added: KubernetesApiModel(currentContextObject=Context(name=prod-onprem, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-onprem.yaml, originalNamespace=ermittlungsbericht-archiv, clusterPath=null))
2024-08-02 20:43:39,354 [   6110]   INFO - #c.i.k.a.KubernetesApiProvider - Model added: KubernetesApiModel(currentContextObject=Context(name=prod-gcp-common, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-gcp-common.yaml, originalNamespace=sentry, clusterPath=null))
2024-08-02 20:43:39,356 [   6112]   INFO - #c.i.k.a.KubernetesApiProvider - Model added: KubernetesApiModel(currentContextObject=Context(name=test-onprem, kubeConfigUrl=file://C:/Users/creckord/.kube/test-onprem.yaml, originalNamespace=ars-selenium1, clusterPath=null))
2024-08-02 20:43:39,356 [   6112]   INFO - #c.i.k.a.KubernetesApiProvider - Model added: KubernetesApiModel(currentContextObject=Context(name=test-onprem-oracle, kubeConfigUrl=file://C:/Users/creckord/.kube/test-onprem-oracle.yaml, originalNamespace=oracle-database-enterprise-edition, clusterPath=null))
2024-08-02 20:43:39,356 [   6112]   INFO - #c.i.k.a.KubernetesApiProvider - Model added: KubernetesApiModel(currentContextObject=Context(name=prod-gcp-star, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-gcp-star.yaml, originalNamespace=kafka, clusterPath=null))
2024-08-02 20:43:39,358 [   6114]   INFO - #c.i.k.a.KubernetesApiProvider - Model added: KubernetesApiModel(currentContextObject=Context(name=prod-dc, kubeConfigUrl=file://C:/Users/creckord/.kube/prod-dc.yaml, originalNamespace=ars, clusterPath=null))
2024-08-02 20:43:39,358 [   6114]   INFO - #c.i.k.a.KubernetesApiProvider - Configuration refresh finished
2024-08-02 20:43:39,359 [   6115]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/microk8s.yaml
2024-08-02 20:43:39,360 [   6116]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-dc.yaml
2024-08-02 20:43:39,360 [   6116]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-onprem-analytics.yaml
2024-08-02 20:43:39,360 [   6116]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-onprem.yaml
2024-08-02 20:43:39,360 [   6116]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-gcp-common.yaml
2024-08-02 20:43:39,360 [   6116]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-gcp-star.yaml
2024-08-02 20:43:39,360 [   6116]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/test-onprem-oracle.yaml
2024-08-02 20:43:39,361 [   6117]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/test-onprem.yaml
2024-08-02 20:43:39,361 [   6117]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-gcp-star.yaml
2024-08-02 20:43:39,361 [   6117]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-gcp-common.yaml
2024-08-02 20:43:39,361 [   6117]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-onprem.yaml
2024-08-02 20:43:39,361 [   6117]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-onprem-analytics.yaml
2024-08-02 20:43:39,361 [   6117]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/prod-dc.yaml
2024-08-02 20:43:39,362 [   6118]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/microk8s.yaml
2024-08-02 20:43:39,362 [   6118]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/test-onprem.yaml
2024-08-02 20:43:39,362 [   6118]   INFO - #c.i.k.m.KubeConfigWatcher - Raw path stored instead of a URL: C:/Users/creckord/.kube/test-onprem-oracle.yaml
2024-08-02 20:43:39,363 [   6119]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:39,363 [   6119]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:39,364 [   6120]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:39,364 [   6120]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:39,364 [   6120]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:39,364 [   6120]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:39,365 [   6121]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:39,365 [   6121]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:39,366 [   6122]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:39,366 [   6122]   INFO - #c.i.k.m.KubeConfigWatcher - Watcher started for: C:\Users\creckord\.kube
2024-08-02 20:43:42,460 [   9216]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-onprem-analytics.yaml
2024-08-02 20:43:42,460 [   9216]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\microk8s.yaml
2024-08-02 20:43:42,460 [   9216]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-onprem.yaml
2024-08-02 20:43:42,460 [   9216]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-gcp-common.yaml
2024-08-02 20:43:42,460 [   9216]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\test-onprem.yaml
2024-08-02 20:43:42,460 [   9216]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\test-onprem-oracle.yaml
2024-08-02 20:43:42,460 [   9216]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-gcp-star.yaml
2024-08-02 20:43:42,460 [   9216]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-dc.yaml
2024-08-02 20:44:17,805 [  44561]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-onprem-analytics.yaml
2024-08-02 20:44:17,805 [  44561]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\microk8s.yaml
2024-08-02 20:44:17,805 [  44561]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-onprem.yaml
2024-08-02 20:44:17,805 [  44561]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-gcp-common.yaml
2024-08-02 20:44:17,805 [  44561]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\test-onprem.yaml
2024-08-02 20:44:17,805 [  44561]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\test-onprem-oracle.yaml
2024-08-02 20:44:17,805 [  44561]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-gcp-star.yaml
2024-08-02 20:44:17,805 [  44561]   INFO - #c.i.k.m.KubeConfigWatcher - Not a regular file: \\C\Users\creckord\.kube\prod-dc.yaml

The IntelliJ Kubernetes integration works just fine, though.

I guess this could be related to how my clusters are set up:

I have a nearly empty .kube/config which basically just holds the current-context:

apiVersion: v1
clusters: null
contexts: null
current-context: prod-gcp-star
kind: Config
preferences: {}
users: null

and then one separate config file for each cluster, each without the current-context key present:

apiVersion: v1
clusters:
- cluster:
  name: gke_team-star_europe-west3-a
  ...
contexts:
- context:
    cluster: gke_team-star_europe-west3-a
    namespace: kafka
    user: gke_team-star_europe-west3-a
  name: prod-gcp-star
kind: Config
preferences: {}
users:
- name: gke_star_europe-west3-a
  user:
    ...

At the command line, with kubectl, this is all tied together through the KUBECONFIG env variable that holds .kube/config and all cluster configs. In IntelliJ, lacking KUBECONFIG support, I just added all the separate configs (sans the .kube/config, which does not include a cluster).

@adietish
Copy link
Collaborator

adietish commented Aug 9, 2024

Hi @creckord

Thanks for reporting this! This seems particularly valuable given your non-standard setup of kubeconfig. At first glance such setup seems to make perfect sense if one has lots of clusters.
I'm looking into it, trying to fix it for the next release 😄

@adietish adietish self-assigned this Aug 9, 2024
@adietish adietish added this to the 1.3.0 milestone Aug 9, 2024
@adietish
Copy link
Collaborator

adietish commented Aug 9, 2024

@creckord I need to replicate it but at first glance I'd guess that our plugin would not detect those cluster files. There's a possibility to set things up via system vars though. I'll look into it and report back.

@adietish
Copy link
Collaborator

adietish commented Aug 9, 2024

for my own documentation purposes:

To set the KUBECONFIG env var one has to list all files and the main conf separated by ":"
(see https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/#append-home-kube-config-to-your-kubeconfig-environment-variable)

export KUBECONFIG="${HOME}/.kube/config:${HOME}/.kube/minikube.yaml:${HOME}/.kube/sandbox.yaml

@adietish
Copy link
Collaborator

adietish commented Aug 9, 2024

This is related to fabric8io/kubernetes-client#2174
I filed fabric8io/kubernetes-client#6240

@adietish
Copy link
Collaborator

adietish commented Aug 9, 2024

@creckord: A fix for fabric8io/kubernetes-client#6240 shouldn't be too complicated, I'm working on it. It could take quite some time for the new client to be released though and our 2 plugins bumped to it (a limitation in the intellij platform requires us to use the same client across all our plugins). Crossing fingers 😄

@creckord
Copy link
Author

@adietish thanks for looking into this. If you want me to try out a build, let me know.

@adietish
Copy link
Collaborator

adietish commented Aug 14, 2024

@creckord awesomeness, if you can check the fixed build, once we have it, that would be stellar. I'll keep you posted.
We'll first release a new version and then fix your issue. I have a POC but special care is needed to not break backward compatibility (as pointed out in fabric8io/kubernetes-client#6240 (comment)).

adietish added a commit to adietish/intellij-kubernetes that referenced this issue Aug 14, 2024
adietish added a commit to adietish/intellij-kubernetes that referenced this issue Aug 14, 2024
@adietish adietish modified the milestones: 1.3.0, 1.5.0 Aug 28, 2024
adietish added a commit to adietish/intellij-kubernetes that referenced this issue Sep 3, 2024
adietish added a commit to adietish/intellij-kubernetes that referenced this issue Sep 3, 2024
adietish added a commit to adietish/intellij-kubernetes that referenced this issue Sep 3, 2024
@adietish
Copy link
Collaborator

adietish commented Sep 3, 2024

@creckord Looks like I have a fix. Will test throughout tomorrow and if things look good I'll have a zip for you that you can download and install if you want :)

adietish added a commit to adietish/intellij-kubernetes that referenced this issue Sep 5, 2024
adietish added a commit to adietish/intellij-kubernetes that referenced this issue Sep 17, 2024
@adietish
Copy link
Collaborator

adietish commented Sep 17, 2024

@creckord: here's a binary that you can manually install and test if you want. Highly appreciate your feedback, thanks!
https://drive.google.com/file/d/1d81V4lWVJVtLzhejCITJGY3V7YproTJ8/view?usp=sharing

You can install it from Disk in Settings > Plugins > "gear" icon > Install Plugin from Disk

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📝 In Progress
Development

Successfully merging a pull request may close this issue.

2 participants