{"id":15965193,"url":"https://github.com/bwplotka/kubelet-bench","last_synced_at":"2025-10-13T12:41:05.333Z","repository":{"id":79051059,"uuid":"459721467","full_name":"bwplotka/kubelet-bench","owner":"bwplotka","description":"Example Go-based e2e benchmark for various Kubelet operations without spinning up whole K8s cluster.","archived":false,"fork":false,"pushed_at":"2022-03-04T12:24:12.000Z","size":35,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T13:30:28.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bwplotka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-15T19:31:12.000Z","updated_at":"2022-03-17T12:02:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc30f1c7-18a4-4d48-9cc2-ef6ee96d6097","html_url":"https://github.com/bwplotka/kubelet-bench","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bwplotka/kubelet-bench","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwplotka%2Fkubelet-bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwplotka%2Fkubelet-bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwplotka%2Fkubelet-bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwplotka%2Fkubelet-bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bwplotka","download_url":"https://codeload.github.com/bwplotka/kubelet-bench/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwplotka%2Fkubelet-bench/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015056,"owners_count":26085643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-07T17:40:21.413Z","updated_at":"2025-10-13T12:41:05.313Z","avatar_url":"https://github.com/bwplotka.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubelet-bench\n\nAn example of Go based e2e benchmark for various Kubelet operations without spinning up whole K8s cluster.\n\n### Motivation\n\nSometimes you want to test or benchmark simple operation on one of the components from bigger system. In my case I needed to test and benchmark `kubelet` [metric endpoint optimizations](https://github.com/google/cadvisor/pull/2974) we made.\n\nUsually to run newest `kubelet` from source involves running full Kubernetes cluster, ideally on some external cloud provider virtual machines. In order to do so I would probably hit thousands of unrelated issues and bottlenecks only to test very simple operation on `kubelet` which in calling `/cadvisor/metric` endpoint.\n\nInstead of spinning full cluster I decided to use my dev machine, build `kubelet` from source, put in container and use our amazing [e2e framework](https://github.com/efficientgo/e2e) (shameless plug) that supports among other things, programmatic, interactive test/benchmarking with built-in Prometheus monitoring integration. The challenge here is run `kubelet` without any other component (e.g `kube-api`) other than `docker` engine.\n\nIt was not trivial for me, since I am not strictly a Kubernetes developer, so I had to reverse engineer many things. It might be not simpler for others too, so I decided to show how to do it in this repo. Enjoy!\n\n### Prerequisite\n\n* Linux machine\n* `docker` installed\n* `Go` 1.17+\n* Cloned https://github.com/kubernetes/kubernetes somewhere locally.\n\n### Usage\n\n1. First of all run `bash build-kubelet.sh \u003clocal path to Kubernetes repo\u003e`. This should build kubelet from the source you have and put that in local `docker:latest` image.\n\n2. Check [./kubelet_bench_test.go](./kubelet_bench_test.go) which should be self-explanatory. It contains single Go test that you can run as usual using `go -v test ./...`. This tests starts interactive docker environment with `kubelet` and `Prometheus` (and some docker CRI-O shim) and spams it with couple of `/cadvisor/metrics` calls.\n\n3. After that Prometheus UI should show up in your browser with relevant view on `kubelet` performance.\n\n4. You can kill test by finding test output line `Waiting for user HTTP request on  http://\u003csome local address\u003e ...` and going to this address.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwplotka%2Fkubelet-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbwplotka%2Fkubelet-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwplotka%2Fkubelet-bench/lists"}