{"id":13448963,"url":"https://github.com/engineerd/kube-exec","last_synced_at":"2025-06-13T01:40:30.427Z","repository":{"id":57498930,"uuid":"116486612","full_name":"engineerd/kube-exec","owner":"engineerd","description":"Lightweight Golang package for executing commands in remote Kubernetes pods","archived":false,"fork":false,"pushed_at":"2019-02-22T06:24:14.000Z","size":523,"stargazers_count":93,"open_issues_count":8,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T02:08:58.849Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://engineerd.github.io/kube-exec/introduction/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/engineerd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-06T13:50:49.000Z","updated_at":"2024-01-29T18:34:02.000Z","dependencies_parsed_at":"2022-09-06T17:11:50.418Z","dependency_job_id":null,"html_url":"https://github.com/engineerd/kube-exec","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineerd%2Fkube-exec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineerd%2Fkube-exec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineerd%2Fkube-exec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineerd%2Fkube-exec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/engineerd","download_url":"https://codeload.github.com/engineerd/kube-exec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245002913,"owners_count":20545512,"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":[],"created_at":"2024-07-31T06:00:26.443Z","updated_at":"2025-03-22T18:32:09.132Z","avatar_url":"https://github.com/engineerd.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"kube-exec\n=========\n\n[![CircleCI](https://circleci.com/gh/engineerd/kube-exec/tree/master.svg?style=shield\u0026circle-token=13a8324e6b860dc9158a67d0102920047b5c1144)](https://circleci.com/gh/engineerd/kube-exec)\n[![Go Report Card](https://goreportcard.com/badge/github.com/engineerd/kube-exec)](https://goreportcard.com/report/github.com/engineerd/kube-exec)\n[![Documentation](https://godoc.org/github.com/engineerd/kube-exec?status.svg)](https://godoc.org/github.com/engineerd/kube-exec)\n\n`kube-exec` is a library similar to [`os/exec`][1] that allows you to run commands in a Kubernetes pod, as if that command was executed locally.\n\u003e It is inspired from [`go-dexec`][2] by [ahmetb][3], which does the same thing, but for a Docker engine.\n\nThe interface of the package is similar to `os/exec`, and essentially this:\n\n- creates a new pod in Kubernetes based on a user-specified image\n- waits for the pod to be in [`Running`](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/) state\n- attaches to the pod and allows you to stream data to the pod through `stdin`, and from the pod back to the program through `stdout` and `stderr`\n\n\nHow to use it\n-------------\n\n```go\ncfg := kube.Config{\n\tKubeconfig: os.Getenv(\"KUBECONFIG\"),\n\tImage:      \"ubuntu\",\n\tName:       \"kube-example\",\n\tNamespace:  \"default\",\n}\n\ncmd := kube.Command(cfg, \"/bin/sh\", \"-c\", \"sleep 2; echo Running from Kubernetes pod;\")\ncmd.Stdout = os.Stdout\n\nerr := cmd.Run()\nif err != nil {\n\tlog.Fatalf(\"error: %v\", err)\n}\n```\n\n\nHere's a list of full examples you can find in this repo:\n\n- [simple hello example](/examples/hello/main.go)\n- [pass `stdin` to the pod](/examples/stdin/main.go)\n- [pass Kubernetes secrets as environment variables](/examples/secrets/main.go)\n\n\n[1]: https://golang.org/pkg/os/exec\n[2]: https://github.com/ahmetb/go-dexec\n[3]: https://twitter.com/ahmetb\n\n[4]: /examples/main.go\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineerd%2Fkube-exec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengineerd%2Fkube-exec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineerd%2Fkube-exec/lists"}