{"id":17201910,"url":"https://github.com/googs1025/kubectl-plugin-develop","last_synced_at":"2026-05-19T07:06:58.073Z","repository":{"id":138976851,"uuid":"560503350","full_name":"googs1025/kubectl-plugin-develop","owner":"googs1025","description":"对kubectl进行简易的插件式开发","archived":false,"fork":false,"pushed_at":"2022-12-06T11:16:40.000Z","size":222,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T08:28:48.151Z","etag":null,"topics":["client-go","kubectl","kubectl-plugins","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googs1025.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-11-01T16:38:02.000Z","updated_at":"2022-12-15T01:00:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"0c387f2a-820d-47ac-8545-a28487b7dd9f","html_url":"https://github.com/googs1025/kubectl-plugin-develop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googs1025%2Fkubectl-plugin-develop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googs1025%2Fkubectl-plugin-develop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googs1025%2Fkubectl-plugin-develop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googs1025%2Fkubectl-plugin-develop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googs1025","download_url":"https://codeload.github.com/googs1025/kubectl-plugin-develop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245431723,"owners_count":20614184,"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","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":["client-go","kubectl","kubectl-plugins","kubernetes"],"created_at":"2024-10-15T02:13:04.434Z","updated_at":"2025-10-15T03:50:33.899Z","avatar_url":"https://github.com/googs1025.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## kubectl-插件开发\n本项目为主要开发**pod**与**deployment**项目。\n\n子项目在目录：kubectl-plugin-develop/test_plugin/\n子项目是对常见资源的list操作开发。\n## 基本方法\n```\n1. 写个可执行程序(先执行chmod +x xxxx)，并放到PATH目录下。  \n2. 文件名必须是kubectl-xxxx\n3. 放入/local/bin下\n3、kubectl plugin list    ---验证一下\n```\n## 对kubectl进行简易插件化开发\n![](https://github.com/googs1025/kubectl-plugin-develop/blob/main/image/kubectl-ice.png?ram=true)\n### 1. 本地编译\n```bigquery\n本地编译\ngo build -o kubectl-pods .\nchmod 777 kubectl-pods\nmv kubectl-pods ~/go/bin/\n```\n\n### 2. pod \n```bigquery\n命令示范\n1. kubectl list pods\n2. kubectl list pods --show-labels\n3. kubectl list pods --show-labels --feilds \"spec.nodeName=aa\"\n4. kubectl list pods --show-labels --labels \"app=aa\"\n5. kubectl pods prompt 交互式\n(base) xxxxxMacBook-Pro:kubectl_plugin_develop zhenyu.jiang$ kubectl pods prompt\n\u003e\u003e\u003e list\n从缓存取\nPOD名称                         NAMESPACE       POD IP          状态    \nhello-world-68fdbf5747-679dk    default         172.17.0.7      Running \nhello-world-68fdbf5747-w789w    default         172.17.0.4      Running \nhello-world-1-745964bf47-8wst8  default         172.17.0.2      Running \nhello-world-1-745964bf47-m7m4w  default         172.17.0.3      Running \n\u003e\u003e\u003e get h (只要打出h就会显示如下)\n          hello-world-68fdbf5747-w789w    节点:minikube 状态:Running IP:172.17.0.4  \n          hello-world-1-745964bf47-8wst8  节点:minikube 状态:Running IP:172.17.0.2  \n          hello-world-1-745964bf47-m7m4w  节点:minikube 状态:Running IP:172.17.0.3  \n          hello-world-68fdbf5747-679dk    节点:minikube 状态:Running IP:172.17.0.7\n\n```\n\n### 补充\n**fields 字段的限制**\n```bigquery\nmetadata.name\nmetadata.namespace\nspec.nodeName\nspec.restartPolicy\nspec.serviceAccountName\nstatus.phase\nstatus.podIP\nstatus.podIPs\nstatus.nominatedNodeName\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogs1025%2Fkubectl-plugin-develop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogs1025%2Fkubectl-plugin-develop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogs1025%2Fkubectl-plugin-develop/lists"}