Not able to run kubectl cp command in Argo workflow

1/29/2022

I am trying to run this command in my Argo workflow

kubectl cp /tmp/appendonly.aof redis-node-0:/data/appendonly.aof -c redis -n redis

but I get this error

Error from server (InternalError): an error on the server ("invalid upgrade response: status code 200") has prevented the request from succeeding (get pods redis-node-0)

surprisingly when I am copying the file from a pod to local system then it is working, like this command kubectl cp redis-node-0:/data/appendonly.aof tmp/appendonly.aof -c redis -n redis

Any idea what might be causing it?

-- Viplove
argo
argo-workflows
kubectl
kubernetes
redis

1 Answer

1/29/2022

Solution - Not sure what was causing this issue but found this command in the docs that worked fine

tar cf - appendonly.aof | kubectl exec -i -n redis redis-node-0 -- tar xf - -C /data

-- Viplove
Source: StackOverflow