Skip to content

Conversation

girdharagrawalbro
Copy link

@girdharagrawalbro girdharagrawalbro commented Oct 16, 2025

Adds documentation for the kubectl cp subcommand that copies files to/from containers.

Closes part of #17606 (kubectl troubleshooting and debugging commands).

Changes

  • Created pages/common/kubectl-cp.md with 5 practical examples
  • Covers bidirectional copy operations for files and directories
  • Includes namespace and multi-container pod examples
  • Follows style guide: imperative mood, clear path syntax, proper placeholders

Examples

  • Copy local file to pod
  • Copy file from pod to local
  • Copy directory recursively
  • Copy with namespace specification
  • Use specific container in multi-container pod

@CLAassistant
Copy link

CLAassistant commented Oct 16, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added new command Issues requesting creation of a new page or PRs adding a new page for a command. review needed Prioritized PRs marked for reviews from maintainers. labels Oct 16, 2025
@dmmqz dmmqz mentioned this pull request Oct 16, 2025
43 tasks
Copy link
Member

@Managor Managor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply to whole page


- Copy a local file to a pod:

`kubectl cp {{path/to/local_file}} {{pod_name}}:{{/path/in/pod}}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`kubectl cp {{path/to/local_file}} {{pod_name}}:{{/path/in/pod}}`
`kubectl cp {{path/to/local_file}} {{pod_name}}:/{{path/in/pod}}`

Leave the initial slash outside the placeholder to indicate that it's mandatory and always an absolute path

@Managor
Copy link
Member

Managor commented Oct 17, 2025

Apply the suggestion to all examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new command Issues requesting creation of a new page or PRs adding a new page for a command. review needed Prioritized PRs marked for reviews from maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants