{"id":15713396,"url":"https://github.com/telemaco019/duplik8s","last_synced_at":"2025-05-07T01:45:27.498Z","repository":{"id":240526699,"uuid":"799269879","full_name":"Telemaco019/duplik8s","owner":"Telemaco019","description":"kubectl plugin to duplicate resources in a Kubernetes cluster.","archived":false,"fork":false,"pushed_at":"2025-04-21T09:32:55.000Z","size":3598,"stargazers_count":52,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-21T10:29:34.067Z","etag":null,"topics":["kubectl","kubectl-plugin","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Telemaco019.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2024-05-11T16:20:23.000Z","updated_at":"2025-04-21T09:32:58.000Z","dependencies_parsed_at":"2024-05-19T15:24:48.738Z","dependency_job_id":"ab667e4c-852e-452b-bc9a-608592f36680","html_url":"https://github.com/Telemaco019/duplik8s","commit_stats":null,"previous_names":["telemaco019/duplik8s"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telemaco019%2Fduplik8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telemaco019%2Fduplik8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telemaco019%2Fduplik8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telemaco019%2Fduplik8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Telemaco019","download_url":"https://codeload.github.com/Telemaco019/duplik8s/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252798762,"owners_count":21805879,"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":["kubectl","kubectl-plugin","kubectl-plugins","kubernetes"],"created_at":"2024-10-03T21:22:30.259Z","updated_at":"2025-05-07T01:45:27.474Z","avatar_url":"https://github.com/Telemaco019.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Duplik8s\n\n---\n\n**Duplicate** 🔁 kubectl plugin to duplicate resources in a Kubernetes cluster.\n\n\u003cp\u003e\n    \u003ca href=\"https://github.com/Telemaco019/duplik8s/actions\"\u003e\u003cimg src=\"https://github.com/Telemaco019/duplik8s/actions/workflows/ci.yaml/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n![](./docs/demo.gif)\n\n**duplik8s** allows you to easily duplicate Kubernetes Pods with overridden commands and configurations. This is useful\nfor testing, debugging, and development purposes.\nThink of **duplik8s** as\n[kubectl debug --copy-to](https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/#copying-a-pod-while-changing-its-command)\non steroids:\n\n- **Support multiple resources**: Duplicate not just Pods, but also `Deployments` and `StatefulSets`.\n- **Easy Tracking**: All duplicated resources are tagged with a duplik8s label for easy identification and cleanup.\n- **Persistent Storage Handling**: Smoothly duplicate Pods mounting persistent volumes without issues.\n- **Probes cleanup**: Disable liveness and readiness probes to keep the cloned Pod idle and avoid restarts.\n- **User-Friendly Syntax**: straightforward syntax that simplifies the selection and duplication of resources.\n\n## Installation\n\n### Install with [Krew](https://krew.sigs.k8s.io/docs/user-guide/quickstart/)\n\n```sh\n$ kubectl krew install duplicate\n```\n\n### Install with Homebrew (Mac/Linux)\n\n```sh\n$ brew tap Telemaco019/duplik8s\n$ brew install duplik8s\n```\n\n### Install with Go\n\n```sh\n$ go install github.com/telemaco019/duplik8s/kubectl-duplicate@latest\n```\n\n### Use as k9s plugin\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e Demo \u003c/b\u003e\u003c/summary\u003e\n\n![](./docs/demo-k9s.gif)\n\n\u003c/details\u003e\n\nAs you might have guessed, **duplik8s** shines when used in combination with the\namazing [k9s](https://github.com/derailed/k9s) ✨.\n\nAfter installing `duplik8s`, you can add it to your k9s plugins by adding the following to\nyour `$XDG_CONFIG_HOME/k9s/plugins.yml` file.\n\nAfter reloading k9s, you should be able to duplicate Pods with `Ctrl-T`.\n\n```yaml\n# $XDG_CONFIG_HOME/k9s/plugins.yaml\nplugins:\n  duplik8s-pod:\n    shortCut: Ctrl-T\n    description: Duplicate Pod\n    scopes:\n      - po\n    command: kubectl\n    background: true\n    args:\n      - duplicate\n      - pod\n      - $NAME\n      - -n\n      - $NAMESPACE\n      - --context\n      - $CONTEXT\n  duplik8s-deploy:\n    shortCut: Ctrl-T\n    description: Duplicate Deployment\n    scopes:\n      - deploy\n    command: kubectl\n    background: true\n    args:\n      - duplicate\n      - deploy\n      - $NAME\n      - -n\n      - $NAMESPACE\n      - --context\n      - $CONTEXT\n```\n\nOn MacOS, you can find the `plugins.yml` file at `~/Library/Application Support/k9s/plugins.yaml`.\n\nFor more information on k9s plugins, you can refer to the [official documentation](https://k9scli.io/topics/plugins).\n\n## Examples\n\n**duplik8s** supports all the standard flags available in `kubectl`, such as `--namespace`, `--context`,\nand `--kubeconfig`. You can get the full list of flags by running `kubectl duplicate --help`.\n\n### Duplicate a Pod\n\n```sh\n$ kubectl duplicate pod my-pod\n```\n\nThe cloned Pod will be identical to the original, but with probes disabled and commands overridden to keep it idle.\n\n### Interactively select a Pod to duplicate\n\n```sh\n$ kubectl duplicate pod\n```\n\nThe command will prompt you to select a Pod from the list of available Pods in the specified namespace.\n\n### Duplicate a Deployment\n\n```sh\n$ kubectl duplicate deployment my-deployment\n```\n\n### Run a specific command in a cloned Pod\n\n```sh\n$ kubectl duplicate pod nginx-pod --command-override \"/bin/sh\",\"-c\",\"echo Hello, World\"\n```\n\nWith this, you can easily duplicate a Pod and run any command you want in the new instance.\n\n### List all duplicated resources\n\nThe command will list all the resources duplicated by **duplik8s**.\n\n```sh\n$ kubectl duplicate list\n```\n\n### Cleanup duplicated resources\n\nThe command will show you all the duplicated resources and ask you to confirm the deletion.\n\n```sh\n$ kubectl duplicate cleanup\n```\n\n## Use cases\n\n**Scenario 1**: You've got a Pod running, but it's not behaving as expected.\nYou need to dive in and debug the issue, maybe install some extra tools along the way.\n\n**Scenario 2**: You need to run some scripts or commands in the exact same environment as a running Pod,\nincluding all the environment variables, secrets, and configurations.\n\nIn these cases, you don't want to risk messing with the live Pod.\nInstead, just use `duplik8s`! It duplicates the Pod with the same specs but keeps it idle so you can open a shell\nand troubleshoot without any disruptions. 🎉\n\nSkip the hassle of manually copying configurations, changing commands, and tweaking probes.\nWith `duplik8s`, simply run `kubectl duplicate pod my-pod` and you're done! Want to customize? Just add flags. Easy\npeasy! ⚡\n\nEven better, if you're using `duplik8s` with `k9s`, just press `Ctrl-T` to duplicate the Pod and s to open a shell\nin one of its containers. 🚀\n\n---\n\n## License\n\nThis project is licensed under the Apache License. See the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelemaco019%2Fduplik8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelemaco019%2Fduplik8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelemaco019%2Fduplik8s/lists"}