{"id":40878964,"url":"https://github.com/huazhihao/kubespy","last_synced_at":"2026-01-22T01:09:28.416Z","repository":{"id":47624671,"uuid":"229376979","full_name":"huazhihao/kubespy","owner":"huazhihao","description":"pod debugging tool for kubernetes clusters with docker runtimes","archived":false,"fork":false,"pushed_at":"2021-08-22T16:25:53.000Z","size":559,"stargazers_count":139,"open_issues_count":4,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-08T20:29:21.219Z","etag":null,"topics":["debugging","krew","kubectl","kubectl-plugin","kubectl-spy","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/huazhihao.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}},"created_at":"2019-12-21T04:40:45.000Z","updated_at":"2025-11-04T04:27:14.000Z","dependencies_parsed_at":"2022-08-29T23:22:17.309Z","dependency_job_id":null,"html_url":"https://github.com/huazhihao/kubespy","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/huazhihao/kubespy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huazhihao%2Fkubespy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huazhihao%2Fkubespy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huazhihao%2Fkubespy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huazhihao%2Fkubespy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huazhihao","download_url":"https://codeload.github.com/huazhihao/kubespy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huazhihao%2Fkubespy/sbom","scorecard":{"id":471838,"data":{"date":"2025-08-11","repo":{"name":"github.com/huazhihao/kubespy","commit":"b08fae382b505d50c76e7ca18a57213003148862"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 2/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/huazhihao/kubespy/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/huazhihao/kubespy/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/huazhihao/kubespy/test.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.4.0 not signed: https://api.github.com/repos/huazhihao/kubespy/releases/48242873","Warn: release artifact v0.3.3 not signed: https://api.github.com/repos/huazhihao/kubespy/releases/23063916","Warn: release artifact v0.3.1 not signed: https://api.github.com/repos/huazhihao/kubespy/releases/22600557","Warn: release artifact v0.3.0 not signed: https://api.github.com/repos/huazhihao/kubespy/releases/22600439","Warn: release artifact v0.2.0 not signed: https://api.github.com/repos/huazhihao/kubespy/releases/22500791","Warn: release artifact v0.4.0 does not have provenance: https://api.github.com/repos/huazhihao/kubespy/releases/48242873","Warn: release artifact v0.3.3 does not have provenance: https://api.github.com/repos/huazhihao/kubespy/releases/23063916","Warn: release artifact v0.3.1 does not have provenance: https://api.github.com/repos/huazhihao/kubespy/releases/22600557","Warn: release artifact v0.3.0 does not have provenance: https://api.github.com/repos/huazhihao/kubespy/releases/22600439","Warn: release artifact v0.2.0 does not have provenance: https://api.github.com/repos/huazhihao/kubespy/releases/22500791"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T14:06:10.945Z","repository_id":47624671,"created_at":"2025-08-19T14:06:10.946Z","updated_at":"2025-08-19T14:06:10.946Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28648504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T21:29:11.980Z","status":"ssl_error","status_checked_at":"2026-01-21T21:24:31.872Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["debugging","krew","kubectl","kubectl-plugin","kubectl-spy","kubernetes"],"created_at":"2026-01-22T01:09:27.871Z","updated_at":"2026-01-22T01:09:28.411Z","avatar_url":"https://github.com/huazhihao.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubespy\n\n[![Build Status](https://github.com/huazhihao/kubespy/actions/workflows/test.yml/badge.svg)](https://github.com/huazhihao/kubespy/actions/workflows/test.yml)\n[![LICENSE](https://img.shields.io/github/license/huazhihao/kubespy.svg)](https://github.com/huazhihao/kubespy/blob/master/LICENSE)\n[![Releases](https://img.shields.io/github/v/release/huazhihao/kubespy.svg)](https://github.com/huazhihao/kubespy/releases)\n\n`kubespy` is a kubectl plugin to debug a running pod. It creates a short-lived `spy container`, using specified image containing all the required debugging tools, to \"spy\" the target container by joining its OS namespaces. So the original target container image can keep clean without sacrificing the convenience for debugging on demand.\n\n`kubespy` is similar to [kubectl-debug](https://github.com/verb/kubectl-debug). In contrast to the latter, kubespy works without the EphemeralContainers feature which is an experimental alpha feature and needs to be activated per pod.\n\nMeanwhile `kubespy` has its own prerequisites - the cluster must use docker as container runtime and you need to be able to run privileged pods.\n\n## Installation\n\nYou can install either from source or with `krew`\n\n### Install from source\n\n```sh\n$ curl -so kubectl-spy https://raw.githubusercontent.com/huazhihao/kubespy/master/kubespy\n$ sudo install kubectl-spy /usr/local/bin/\n```\n\n### Install with `krew`\n\n```sh\n$ kubectl krew install spy\n```\n\n## Usage\n\n```sh\n$ kubectl spy [-c CONTAINER] [-n NAMESPACE] [--spy-image IMAGE] POD\n```\n\n## Examples\n\n[![asciicast](https://asciinema.org/a/290096.svg)](https://asciinema.org/a/290096)\n\n```sh\n# debug the primary (first) container in pod mypod\n$ kubectl spy mypod\n\n# specify pod namespace\n$ kubectl spy mypod -n default\n\n# specify debugee container\n$ kubectl spy mypod -c mycontainer\n\n# specify spy-image\n$ kubectl spy mypod --spy-image busybox\n\n# specify entrypoint for interaction\n$ kubectl spy mypod --entrypoint /bin/sh\n```\n\n## Workflow\n\n```\nlocal machine: kubectl spy\n                    |\n                    v\nmaster node:   kube-apiserver\n                    |\n                    v\nworker node:   kubelet\n                    | create\n                    v\n               spy container\n                    | join namespace: pid/net/ipc/mount\n                    v\n               target container\n```\n\n## Advanced Usage\n\n### Remote debugging\n\nBy using kubespy and kubeproxy together, will be able to expose port for remote debugging on a running pod.\n\nBelow is an example illustrating how to remote debug a Go http server.\n\n```sh\n$ kubectl run --image kubespy-port-demo --port=8000 --restart=Never mypod --dry-run=client -o yaml \u003e kubespy-port-demo.yaml\n```\n\nAdd `imagePullPolicy: Never` if you want kubelet to use local image.\n\nCreate pod and service.\n\n```sh\n$ kubectl apply -f kubespy-port-demo.yaml\n$ kubectl expose pod mypod --port=8000 --name=mypod\n$ kubectl get svc\nNAME    TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE\nmypod   ClusterIP   10.111.9.130   \u003cnone\u003e        8000/TCP   9s\n\n$ curl http://10.111.9.130:8000\n{\"message\":\"hello\"}\n```\n\nRun `kubespy` and install dlv. dlv's remote debugging protocol is json/rpc via tcp/streaming.\n\n```sh\n$ ./kubespy --spy-image golang mypod\nloading spy pod spy-7bdaf6b74933 ...\nIf you don't see a command prompt, try pressing enter.\n\n# go install github.com/go-delve/delve/cmd/dlv@latest\n```\n\nIn this case, ptrace is required on node.\n\n```sh\necho 0 \u003e /proc/sys/kernel/yama/ptrace_scope\n```\n\nRun dlv to attach Go process.\n\nNote: dlv will ignore most OS signals except SIGKILL. In order to close dlv and spy container after, it is better run dlv at background.\n\n```\n# ps aux\nUSER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND\nroot         1  0.0  0.3 708144  7012 ?        Ssl  03:29   0:00 /go/bin/kubespy-port-demo\nroot        11  0.4  0.0   2416   576 pts/0    Ss   03:34   0:00 /bin/sh\nroot        18  0.0  0.1   6696  2892 pts/0    R+   03:34   0:00 ps aux\n\n# dlv --listen=:2345 --headless=true --log=true --log-output=debugger,debuglineerr,gdbwire,lldbout,rpc --api-version=2 --accept-multiclient attach 1 \u0026\u003e\u003e dlv.log \u0026\n```\n\nRun kubeproxy to forward debug port\n\n```\n$ kubectl port-forward --address 0.0.0.0 mypod 2345\nForwarding from 0.0.0.0:2345 -\u003e 2345\n```\n\nSuppose you are using vscode. Create `.vscode/launch.json` with below content.\n\n```json\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"go\",\n      \"type\": \"go\",\n      \"request\": \"attach\",\n      \"mode\": \"remote\",\n      \"port\": 2345,\n      \"host\": \"your_kubeproxy_IP\",\n      \"trace\": \"verbose\"\n    }\n  ]\n}\n```\n\nStart debugging in vscode\n\n![dlv-screenshot](etc/dlv-screenshot.png?raw=true)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuazhihao%2Fkubespy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuazhihao%2Fkubespy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuazhihao%2Fkubespy/lists"}