Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--pod and -p don't select a single pod #297

Closed
robert-burden opened this issue May 29, 2019 · 7 comments
Closed

--pod and -p don't select a single pod #297

robert-burden opened this issue May 29, 2019 · 7 comments

Comments

@robert-burden
Copy link

robert-burden commented May 29, 2019

I have a replica set with several with two pods. No matter what I try I cannot make ksync only select a specific pod.

Following the readme I tried:
ksync create --name test --pod api-server-7d48bfc846-2zdg8 /local/scripts/ /pod/scripts

  • This seems to completely ignore the --pod parameter and try to connect to all pods in the namespace.

ksync create --name test --pod api-server-7d48bfc846-2zdg8 -c api-server /local/scripts/ /pod/scripts

  • This selects all the pods using the api-server container which is better because it selects only the two identical pods but ideally I would only want to sync with one.

I have also tried adding "quotes" around the name and setting up the key/value pair like --pod=api-server with identical results

@alok87
Copy link
Contributor

alok87 commented May 30, 2019

Best is to use label selectors.

  1. First edit the pod and see what labels it has
    kubectl edit pod api-server-7d48bfc846-2zdg8

  2. Try to list the pods using kubectl first
    kubectl get pods -n <namespace> -l type=api -l app=api-server

If this list your pod. Then create the ksync configuration using same label selectors(-l).

  1. ksync create --name test -l type=api -l app=api-server /local/scripts/ /pod/scripts

I have not used pods yet as label selectors works perfectly as i want and is better than pod option as pod names can keep changing.

@robert-burden
Copy link
Author

@alok87 I doubt there is a combination of label selectors that will result in selecting a single specific pod from a replica set. There are many cases where someone would want to sync specifically with a pod for the lifecycle of that pod.

I am sure I can work around this for my use case. The purpose of this issue is to note that the flag doesn't work as advertised and should probably be removed from the first step of the README if its not the recommended way of selecting a single pod.

  1. ksync create --pod=my-pod local_directory remote_directory to configure a folder you'd like to sync between your local system and a specific container running on the cluster.

@timfallmk
Copy link
Collaborator

I don't think I've seen someone use that flag before, so I'll take a look shortly to see what it's doing.

@AndrienkoAleksandr
Copy link

+1 saw the same. It works good when I set up pod '-p' and container '-c', but if I set up only pod -p -> seems ksync trying to watch all pods.

@grampelberg
Copy link
Collaborator

Interesting, definitely a bug in there somewhere.

@provAlexSage
Copy link

provAlexSage commented Apr 27, 2020

This is because the flag format doesn't accept the space and needs the equal sign. I just ran into this earlier today.

ksync create --name test --pod=api-server-7d48bfc846-2zdg8 -c api-server /local/scripts/ /pod/scripts

@timfallmk
Copy link
Collaborator

I'm going to mark this as solved. Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants