Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy file from local system to kubernetes pods with new kubectl version

I'm trying to copy files from my local to kubernetes pods. I've been using the command for a very few months now and everything worked fine:

kubectl cp C:/test.jar backend-0:/usr/local/myproject/tomcat/webapps/WEB-INF/lib -c tomcat

Now I bought a new computer, re-configured the development environment, and now when I try to use the same command, I see an error:

error: one of src or dest must be a local file specification

I'm using Google Cloud SDK as a terminal. The old computer had the Google Cloud SDK version 368.0.0, now it's 396.0.0. Also, kubectl version changed, was 1.16.6 now it's 1.22.12.

Please tell me which command in the terminal will be relevant now, how should I use copying? Thanks!

like image 684
Mikhail Krasikov Avatar asked Oct 15 '25 23:10

Mikhail Krasikov


1 Answers

You cannot use absolute paths like C:/test.jar

You can try the following:

  1. Make sure you are under c:/
  2. Execute:
    kubectl cp test.jar backend-0:/usr/local/myproject/tomcat/webapps/WEB-INF/lib -c tomcat
like image 200
The Ice Coder Avatar answered Oct 18 '25 16:10

The Ice Coder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!