emirozer / kubectl-doctor Goto Github PK
View Code? Open in Web Editor NEWkubectl cluster triage plugin for k8s - π₯ (brew doctor equivalent)
License: Apache License 2.0
kubectl cluster triage plugin for k8s - π₯ (brew doctor equivalent)
License: Apache License 2.0
krew
(which is the common way of installing kubectl
plugins) expects the assets to be archive files.
The previous two releases (0.2.1 and 0.3.0) had the assets as archive files, but the latest one (0.3.1) doesn't.
krew
PR for updating to 0.3.1 for reference: kubernetes-sigs/krew-index#2243
Hi Emir,
This is pretty much a feature request rather than a bug; In our current environment we have a few dev clusters getting constant creation/deletion requests, and our CI isn't perfect, so time to time we face situation when we have a bunch of automatically created ingress objects being pointed to Service object don't exist anymore.
I'm just wondering if you can add such case to your sanity check steps and display/auto-delete ingress objects?
I have my applications deployed in multiple namespaces (CICD), but in the report, the namespace is missing. Will be useful to know.
---
TriageReport:
- Resource: Endpoints
AnomalyType: Found orphaned endpoints!
Anomalies:
- discovery-twin-neo4j-1
- discovery-twin-neo4j-2
- discovery-twin-neo4j-3
- discovery-twin-neo4j-4
- discovery-twin-neo4j-5
- production-manager
- production-manager-influxdb
- production-manager-mariadb
- production-wui-dev
- vault
- vault-master
- vault-master-headless
- discovery-twin-neo4j-0
- discovery-twin-neo4j-1
- discovery-twin-neo4j-2
- discovery-twin-neo4j-3
- discovery-twin-neo4j-4
- discovery-twin-neo4j-5
- event-manager-master
- event-manager-master-headless
- twin-neo4j
- vault-master
- vault-master-headless
- discovery-twin-neo4j-1
- discovery-twin-neo4j-2
- discovery-twin-neo4j-3
- discovery-twin-neo4j-4
- discovery-twin-neo4j-5
- twin-api-service-feature-test
- application-server-aa627786a531-mariadb
- cms-client
- diagnostic-manager
- discovery-twin-neo4j-1
- discovery-twin-neo4j-2
- discovery-twin-neo4j-3
- discovery-twin-neo4j-4
- discovery-twin-neo4j-5
- event-manager
- event-manager-master
- production-manager
- production-manager-mariadb
- service-cp-control-center
- openebs.io-local
- monitoring-prometheus-node-exporter
- monitoring-prometheus-node-exporter
I am getting this warning when running this tool against a recent cluster. Probably the client library needs a bump.
INFO[0000] Going for a full scan as no flags are set!
INFO[0000] Retrieving necessary clientset for targeted k8s cluster.
INFO[0000]
INFO[0000] Fetched namespaces: [cert-manager default ingress-nginx kube-node-lease kube-public kube-system]
INFO[0000]
WARN[0001] doctor's client-go version: 11.0.0 is not fully compatible with your k8s server version: 1.19.6-eks-49a6c0
WARN[0001] https://github.com/kubernetes/client-go#compatibility-matrix
WARN[0001] doctor run will be based on best-effort delivery
INFO[0001] Starting triage of cluster crucial component health checks.
Having multiple contexts in the environment variable KUBECONFIG
fails when it tries to scan the provided namespace. The result is exactly the same passing the -n my_namespace
flag or providing a specific context.
$ kubectl doctor
WARN[0000] discovered a list of kubeconfigs & will respect current-context! kubeconfiglist="[/Users/tty0/.kube/config /Users/tty0/.kube/config-dguiaf-prod /Users/tty0/.kube/config-dguiaf-rancher /Users/tty0/.kube/config-dguiaf-dev /Users/tty0/.kube/config-dguiaf-test /Users/tty0/.kube/k3s]"
INFO[0000] Going for a full scan as no flags are set!
INFO[0000] Retrieving necessary clientset for targeted k8s cluster.
INFO[0000]
INFO[0000] Fetched namespaces: []
INFO[0000]
error: namespace must be specified/retrieved properly!
$: kubectl get namespaces
NAME STATUS AGE
default Active 9h
kube-node-lease Active 9h
kube-public Active 9h
kube-system Active 9h
monitoring Active 9h
$: echo $KUBECONFIG
/Users/tty0/.kube/config:/Users/tty0/.kube/config-prod:/Users/tty0/.kube/config-rancher:/Users/tty0/.kube/config-dev:/Users/tty0/.kube/config-test:/Users/tty0/.kube/k3s
$: kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T18:49:28Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3+k3s1", GitCommit:"974ad30be7b7b15f695d88e46ffa96a4d43b2370", GitTreeState:"clean", BuildDate:"2020-10-16T00:18:50Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/arm64"}
π Hello, maintainer of the kubectl plugin manager krew here.
Thank you for your commitment to open source by making this plugin available via krew
!
Krew wants to give credit where credit is due by installing the proper license file for the plugins it distributes. However, your plugin was found to not contain any license file. We wanted to remind you that if you're using a license such as Apache 2.0, you should be bundling your LICENSE file with your pluginβs distributions.
What do you have to do?
files:
section to copy the file to the installation directory. Have a look at this PR for an example: https://github.com/kubernetes-sigs/krew-index/pull/314/filesIf you need further assistance, don't hesitate to ask for help.
π Hello, maintainer of the kubectl plugin manager krew here.
Thank you for your commitment to open source by making this plugin available via krew
!
Krew wants to give credit where credit is due by installing the proper license file for the plugins it distributes. However, your plugin was found to not contain any license file. We wanted to remind you that if you're using a license such as Apache 2.0, you should be bundling your LICENSE file with your pluginβs distributions.
What do you have to do?
files:
section to copy the file to the installation directory. Have a look at this PR for an example: https://github.com/kubernetes-sigs/krew-index/pull/314/filesIf you need further assistance, don't hesitate to ask for help.
Hello,
Krew doesn't have the latest version of this plugin:
kubectl krew info doctor
NAME: doctor
INDEX: default
URI: https://github.com/emirozer/kubectl-doctor/releases/download/0.3.0/kubectl-doctor_linux_amd64.zip
SHA256: 94ac5b4f6061176ade6650031e85018baf093b2a27b28ce5e73a78af1ceebc2a
VERSION: v0.3.0
HOMEPAGE: https://github.com/emirozer/kubectl-doctor
DESCRIPTION:
This plugin is inspired by brew doctor.
It will scan the active kube-context for anomalies or
useful action points that it can report back to you.
This plugin does not change any state or configuration.
Please check the repository for an example report:
* https://github.com/emirozer/kubectl-doctor
CAVEATS:
\
| This plugin needs higher privileges on core API group.
| Potentially a ClusterRole that can get cluster-scoped resources.
| Such as nodes / all namespaces etc.
/
I tried to make a PR to update the version inside krew store but unfortunately, the format of your release is not an archive format anymore (was a zip before). Do you mind releasing zip files for me to add the update version inside krew store?
Kind regards,
JM
Bases on this message I can't tell what the problem is about.
β ~ kubectl doctor
WARN[0000] KUBECONFIG env var not found falling back to auto discovery!
INFO[0000] Going for a full scan as no flags are set!
INFO[0000] Retrieving necessary clientset for targeted k8s cluster.
INFO[0000]
INFO[0000] Fetched namespaces: [default filebeat klatz-prod kube-node-lease kube-public kube-system prometheus traefik]
INFO[0000]
INFO[0000] Starting triage of cluster crucial component health checks.
INFO[0000] Starting triage of nodes that form the cluster.
INFO[0000] Starting triage of cluster-wide Endpoints resources.
INFO[0000] Starting triage of cluster-wide pvc resources.
INFO[0000] Starting triage of cluster-wide pv resources.
INFO[0000] Starting triage of deployment resources across cluster
Error from server (NotFound): the server could not find the requested resource
β ~ kubectl krew list
PLUGIN VERSION
doctor v0.2.1
β ~ kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T23:43:08Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T19:09:08Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
I work with more than one cluster, so I set the KUBECONFIG
environment variable to list of paths to configuration files as described here.
This causes doctor
to panic.
panic: stat /Users/me/.kube/config:/Users/me/.kube/mini-kube-config:/Users/me/.kube/dev-kube-config:/Users/me/.kube/prod-kube-config: no such file or directory
goroutine 1 [running]:
github.com/emirozer/kubectl-doctor/pkg/client.tryGetKubeConfigFromEnvVar(0x50, 0xc0002c4e60, 0x1ebccc0)
/Users/eoz/go/src/github.com/emirozer/kubectl-doctor/pkg/client/client.go:66 +0x14d
github.com/emirozer/kubectl-doctor/pkg/client.InitClient(0xc0000b00c0)
/Users/eoz/go/src/github.com/emirozer/kubectl-doctor/pkg/client/client.go:32 +0x34
github.com/emirozer/kubectl-doctor/pkg/plugin.init.0()
/Users/eoz/go/src/github.com/emirozer/kubectl-doctor/pkg/plugin/cmd.go:45 +0x97
doctor
should respect the merged config and the current context.
Hi,
I am trying to package this for openSUSE, which means I need to vendor it beforehand (as the build environment has no network connectivity).
Unfortunately it breaks:
ERROR:obs-service-go_modules:go: github.com/emirozer/kubectl-doctor/cmd imports
k8s.io/client-go/plugin/pkg/client/auth imports
k8s.io/client-go/plugin/pkg/client/auth/gcp imports
golang.org/x/oauth2 imports
google.golang.org/appengine/urlfetch: missing go.sum entry for module providing package google.golang.org/appengine/urlfetch (imported by golang.org/x/oauth2); to add:
go get golang.org/x/[email protected]
go: github.com/emirozer/kubectl-doctor/cmd imports
k8s.io/client-go/plugin/pkg/client/auth imports
k8s.io/client-go/plugin/pkg/client/auth/gcp imports
golang.org/x/oauth2/google imports
google.golang.org/appengine: missing go.sum entry for module providing package google.golang.org/appengine (imported by golang.org/x/oauth2/google); to add:
go get golang.org/x/oauth2/[email protected]
ERROR:obs-service-go_modules:go mod vendor failed
Aborting: service call failed: /usr/lib/obs/service/go_modules --outdir /home/Buildservice/Branches/Branch_devel_kubic/kubectl-doctor/tmpx8bnt07m.go_modules.service
According to the output two things are missing in the go.sum file. Could this please be fixed?
Thanks in advance,
Johannes
This plugin doesn't seem compatible with an ARM architecture.
This was the error is got on an M1 Macbook Pro:
Updated the local copy of plugin index.
Installing plugin: doctor
W0131 14:32:10.582641 35625 install.go:164] failed to install plugin "doctor": plugin "doctor" does not offer installation for this platform
F0131 14:32:10.582703 35625 root.go:79] failed to install some plugins: [doctor]: plugin "doctor" does not offer installation for this platform
goroutine 1 [running]:
k8s.io/klog/v2.stacks(0x14000126001, 0x14000156fc0, 0x92, 0xe0)
/home/runner/go/pkg/mod/k8s.io/klog/[email protected]/klog.go:1021 +0xac
k8s.io/klog/v2.(*loggingT).output(0x104a0a900, 0x14000000003, 0x0, 0x0, 0x14000225880, 0x10477d2e5, 0x7, 0x4f, 0x14000173e00)
/home/runner/go/pkg/mod/k8s.io/klog/[email protected]/klog.go:970 +0x164
k8s.io/klog/v2.(*loggingT).printDepth(0x104a0a900, 0x14000000003, 0x0, 0x0, 0x0, 0x0, 0x1, 0x14000183fa0, 0x1, 0x1)
/home/runner/go/pkg/mod/k8s.io/klog/[email protected]/klog.go:733 +0x120
k8s.io/klog/v2.(*loggingT).print(...)
/home/runner/go/pkg/mod/k8s.io/klog/[email protected]/klog.go:715
k8s.io/klog/v2.Fatal(...)
/home/runner/go/pkg/mod/k8s.io/klog/[email protected]/klog.go:1489
sigs.k8s.io/krew/cmd/krew/cmd.Execute()
/home/runner/work/krew/krew/cmd/krew/cmd/root.go:79 +0x224
main.main()
/home/runner/work/krew/krew/cmd/krew/main.go:25 +0x3c
goroutine 18 [chan receive]:
k8s.io/klog/v2.(*loggingT).flushDaemon(0x104a0a900)
/home/runner/go/pkg/mod/k8s.io/klog/[email protected]/klog.go:1164 +0x70
created by k8s.io/klog/v2.init.0
/home/runner/go/pkg/mod/k8s.io/klog/[email protected]/klog.go:418 +0x128```
Please add darwin/arm64 binaries (M1 Macs)
Right now, jobs that haven't run in the last 31ns will be flagged instead of days
I am running doctor on my arm k3s cluster and get presented with an empty report:
ξ° kubectl doctor ξ² β ξ² 1223 ξ² 16:45:35
INFO[0000] Going for a full scan as no flags are set!
INFO[0000] Retrieving necessary clientset for targeted k8s cluster.
INFO[0000]
INFO[0000] Fetched namespaces: [default kube-node-lease kube-public kube-system]
INFO[0000]
INFO[0000] Starting triage of cluster crucial component health checks.
INFO[0001] Starting triage of nodes that form the cluster.
INFO[0001] Starting triage of cluster-wide Endpoints resources.
INFO[0002] Starting triage of cluster-wide pvc resources.
INFO[0002] Starting triage of cluster-wide pv resources.
INFO[0002] Starting triage of deployment resources across cluster
INFO[0004] Starting triage of replicasets resources across cluster
INFO[0007] Starting triage of cronjob resources across cluster
INFO[0009] Triage report coming up in yaml format:
---
TriageReport: []
is there any way I can get a bit more (debug) info to figure out why?
Could you please let me know how to we exclude few checks from this report...
Say I want to exclude leftovers or want to get a report of only PV's..
Please let me know how we do that
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.