kubernetes/kubernetes

kubectl cp command fails when passing full Windows path such as c:\Temp\foobar.txt

Aperta

#101.985 aperta il 13 mag 2021

 (15 commenti) (4 reazioni) (1 assegnatario)Go (43.066 fork)batch import
help wantedkind/bugneeds-triagesig/clisig/windows

Metriche repository

Star
 (122.268 stelle)
Metriche merge PR
 (Merge medio 28g 17h) (343 PR mergiate in 30 g)

Descrizione

What happened:

The following command fails on Windows: kubectl cp c:\Temp\foobar.txt "pod-name:/tmp/forbar.txt" reporting the following: error: one of src or dest must be a local file specification

This issue was already reported https://github.com/kubernetes/kubernetes/issues/77310 and fixed, but regression was introduced in kubectl v1.20. This command copies file successfully in if kubectl version is 1.19, but fails in 1.20 and 1.21

What you expected to happen:

c:\Temp\foobar.txt should be copied to the pod.

How to reproduce it (as minimally and precisely as possible):

On Windows: Create c:\Temp\foobar.txt file and try to run kubectl cp c:\Temp\foobar.txt "pod-name:/tmp/forbar.txt"

I believe, kubectl treats c in c:\Temp\foobar.txt as a pod name.

Anything else we need to know?:

Similar issue: https://github.com/kubernetes/kubernetes/issues/77310

Environment:

  • Kubernetes version (use kubectl version): v1.20 and v1.21
  • Cloud provider or hardware configuration: N/A
  • OS (e.g: cat /etc/os-release): Windows 10
  • Kernel (e.g. uname -a): N/A
  • Install tools:
  • Network plugin and version (if this is a network-related bug):
  • Others:

Guida contributor