intellij-kubernetes
intellij-kubernetes copied to clipboard
Cannot get my clusters to appear
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
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).
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 😄
@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.
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
This is related to https://github.com/fabric8io/kubernetes-client/issues/2174 I filed https://github.com/fabric8io/kubernetes-client/issues/6240
@creckord: A fix for https://github.com/fabric8io/kubernetes-client/issues/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 😄
@adietish thanks for looking into this. If you want me to try out a build, let me know.
@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 https://github.com/fabric8io/kubernetes-client/issues/6240#issuecomment-2287854615).
@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 :)
@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
Hey @adietish, sorry for going silent. I was on vacation from mid-August on, and lost track of this in the post-vacation hustle. I can confirm that my configuration works now and all clusters show up in the plugin window. Thank you.
Oh sorry, reopening this, as the fix doesn't seem to be in the release version yet.
@creckord awesomeness, thanks for testing it 😃 It'll make it into the next version to be released soon.
Hi @creckord, quick ping to let you know that 1.5.0 that's released these days has this officially supported.
I also have proper support for MacOS where KUBECONFIG in .zshrc or .zprofile are not present in IDEA by default (#826). 😃
ps. took quite some time because we were tasked with other plugins. Development on this plugin is back now 😃
Plugin 1.5.0 was released https://plugins.jetbrains.com/plugin/15921-kubernetes-by-red-hat/edit/versions/stable/676929