{"id":31968396,"url":"https://github.com/ihcsim/kubelet-plugin","last_synced_at":"2026-05-16T17:35:09.527Z","repository":{"id":254019530,"uuid":"845233074","full_name":"ihcsim/kubelet-plugin","owner":"ihcsim","description":"An example of CDI kubelet-plugin per specification defined in https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/.","archived":false,"fork":false,"pushed_at":"2024-11-03T22:44:15.000Z","size":22012,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T02:19:17.265Z","etag":null,"topics":["cdi","go","kubelet","kubernetes"],"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/ihcsim.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":"2024-08-20T21:10:34.000Z","updated_at":"2024-11-26T18:59:02.000Z","dependencies_parsed_at":"2024-09-15T21:41:20.648Z","dependency_job_id":"e262e404-2244-456e-8424-1498870f8c78","html_url":"https://github.com/ihcsim/kubelet-plugin","commit_stats":null,"previous_names":["ihcsim/kubelet-plugin"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ihcsim/kubelet-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fkubelet-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fkubelet-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fkubelet-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fkubelet-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ihcsim","download_url":"https://codeload.github.com/ihcsim/kubelet-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fkubelet-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020337,"owners_count":26086867,"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-14T02:00:06.444Z","response_time":60,"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":["cdi","go","kubelet","kubernetes"],"created_at":"2025-10-14T18:52:37.064Z","updated_at":"2025-10-14T18:52:40.094Z","avatar_url":"https://github.com/ihcsim.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubelet-plugin\n\nThis repo contains examples of kubelet plugins that can be used to expose the\nfollowing node devices to the Kubelet:\n\n* KVM device file. The `kvm` plugin points to the local `/dev/kvm`.\n\nFor more information on Kubernetes device plugins, see\nhttps://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/.\n\n## CDI Configuration - containerd\n\nThis plugin uses [CDI](https://github.com/cncf-tags/container-device-interface/)\nfor device discovery.\n\nTo enable CDI support with containerd v1.6+, update the \n`/etc/containerd/config.toml` file to include:\n\n```sh\n[plugins.\"io.containerd.grpc.v1.cri\"]\n  enable_cdi = true\n  cdi_spec_dirs = [\"/etc/cdi\", \"/var/run/cdi\"]\n```\n\nRestart containerd for the changes to take effect.\n\nSet up the sample devices and CDI configuration files:\n\n```sh\n# sudo required\nmake cdi\n```\n\nThe CDI configuration files can be found in the local `/etc/cdi` directory.\n\n## Testing With Kubelet\n\nFor ease of testing purposes, this repo comes with the kubelet v1.31.0 binary. \nThe `KubeletConfiguration` specification is defined in the `kubelet/kubelet.yaml`\nfile.\n\nTo uncompress and start the kubelet:\n\n```sh\n# sudo required\nmake kubelet\n```\n\nThe kubelet logs will be written to `kubelet/kubelet.log`.\n\nRun the plugin against the kubelet:\n\n```sh\n# sudo required\nmake run.kvm\n```\n\nExpect the plugin `github.com.ihcsim/kvm` to register successfully with the kubelet:\n\n```sh   \nI1031 18:55:45.367492   26662 server.go:144] \"Got registration request from device plugin with resource\" resourceName=\"github.com.ihcsim/kvm\"\nI1031 18:55:45.367538   26662 handler.go:94] \"Registered client\" name=\"github.com.ihcsim/kvm\"\n# \u003csnipped\u003e\nI1031 18:55:45.368646   26662 manager.go:229] \"Device plugin connected\" resourceName=\"github.com.ihcsim/kvm\"\n# \u003csnipped\u003e\nI1031 18:55:55.375313   26662 client.go:91] \"State pushed for device plugin\" resource=\"github.com.ihcsim/kvm\" resourceCapacity=1\nI1031 18:55:55.382659   26662 manager.go:278] \"Processed device updates for resource\" resourceName=\"github.com.ihcsim/kvm\" totalCount=1 healthyCount=1\n# \u003csnipped\u003e\n```\n\nDeploy the provided busybox pod to the kubelet as a static pod:\n\n```sh\nmake deploy\n```\n\nThe kubelet logs shows that 1 `github.com.ihcsim/kvm` device is allocated to the\n`kvm` pod:\n\n```sh\nI1102 20:33:21.794935    2195 config.go:398] \"Receiving a new pod\" pod=\"default/kvm-ncqxp\"\n# \u003csnipped\u003e\nI1102 20:33:21.796150    2195 manager.go:580] \"Need devices to allocate for pod\" deviceNumber=1 resourceName=\"github.com.ihcsim/kvm\" podUID=\"d2a6778a-f42d-4880-9ed8-ec5ec6ea6303\" con 194569 tainerName=\"kvm-client\"\nI1102 20:33:21.796167    2195 manager.go:991] \"Plugin options indicate to skip GetPreferredAllocation for resource\" resourceName=\"github.com.ihcsim/kvm\"\nI1102 20:33:21.796176    2195 manager.go:859] \"Making allocation request for device plugin\" devices=[\"kvm0\"] resourceName=\"github.com.ihcsim/kvm\"\n# \u003csnipped\u003e\nI1102 20:44:05.754527   18375 manager.go:813] \"Looking for needed resources\" needed=1 resourceName=\"github.com.ihcsim/kvm\"\nI1102 20:44:05.754530   18375 config.go:105] \"Looking for sources, have seen\" sources=[\"api\",\"file\"] seenSources={\"file\":{}}\nI1102 20:44:05.754536   18375 manager.go:555] \"Found pre-allocated devices for resource on pod\" resourceName=\"github.com.ihcsim/kvm\" containerName=\"kvm-client\" podUID=\"d2a6778a-f42d- 231430 4880-9ed8-ec5ec6ea6303\" devices=[\"kvm0\"]\n```\n\nWith the `ResourceHealthStatus` feature gate enabled, the kubelet also reports \nthe `allocatedResourcesStatus` field in the pod status container status, \nshowing that the healthy device `github.com.ihcsim/crand=crand1` is allocated to the pod:\n\n```json\n{\n  \"allocatedResourcesStatus\": [\n    {\n      \"name\": \"github.com.ihcsim/crand\",\n      \"resources\": [\n        {\n          \"resourceID\": \"crand1\",\n          \"health\": \"Healthy\"\n        },\n        {\n          \"resourceID\": \"crand0\",\n          \"health\": \"Healthy\"\n        }\n      ]\n    }\n  ]\n}\n\n{\n  \"allocatedResourcesStatus\": [\n    {\n      \"name\": \"github.com.ihcsim/kvm\",\n      \"resources\": [\n        {\n          \"resourceID\": \"github.com.ihcsim/kvm\",\n          \"health\": \"Healthy\"\n        }\n      ]\n    }\n  ]\n}\n```\n\n## Development\n\nTo build the plugins:\n\n```sh\nmake build\n\nmake test\n\nmake lint\n```\n\nTo update the Docker image and DaemonSet YAML, download [ko](https://ko.build/).\n\nTo build and push a new Docker image:\n\n```sh\nmake image [KO_DOCKER_REPO=\u003cdocker_repo\u003e]\n```\n\nTo update the DaemonSet YAML with the latest image:\n\n```sh\nmake yaml [KO_DOCKER_REPO=\u003cdocker_repo\u003e]\n```\n\n## Debugging\n\nDownload `delve` from https://github.com/go-delve/delve.\n\nStart by building the debug image:\n\n```sh\nmake image-debug\n```\n\nUse Docker to start the debug container:\n\n```sh\ndocker run -p 40000:40000 \u003cimg\u003e\n```\n\nNow, connect to the debug container:\n\n```sh\ndlv connect 127.0.0.1:40000\n```\n\nFor more information, see https://ko.build/features/debugging/\n\n## Release\n\nTo create a new release, a new tag is required:\n\n```sh\ngit tag -a \u003cnew_tag\u003e -m \"\u003cnew_tag_message\u003e\"\n\ngit push origin \u003cnew_tag\u003e\n```\n\nManually start the `default` GHA pipeline.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihcsim%2Fkubelet-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fihcsim%2Fkubelet-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihcsim%2Fkubelet-plugin/lists"}