How do you wire Pachyderm to the correct Kubernetes context?

I have more than one Kubernetes context. When I change the contexts, I use kill -9

to kill the port forwarding in order to execute the command pachtctl port-forward &

. I wonder if this is the right thing to do.

More details:

I'm starting to be in the Kubernetes context, we'll call it context_x. Then I want to change the context to my local context called minikube. I also want to see my repos for this minikube context, but when I use pachctl list-repo

it still shows the Pachyderm repos context_x. When I do pachctl port-forward

, I get an error about the address that is already in use. So I have to ps -a and then kill -9 in these port forwarding processes and then run the pachctl-port-forward command again.

An example of what I was doing:

$ kubectl config use-context minikube
$ pachctl list-repo #doesn't show minikube context repos
$ pachctl port-forward &
...several error messages along the lines of:
Unable to create listener: Error listen tcp4 127.0.0.1:30650: bind: address already in use
$ ps -a | grep forward
33964 ttys002    0:00.51 kubectl port-forward dash-12345678-abcde 38080:8080
33965 ttys002    0:00.51 kubectl port-forward dash-12345679-abcde 38081:8081
37245 ttys002    0:00.12 pachctl port-forward &
37260 ttys002    0:00.20 kubectl port-forward pachd-4212312322-abcde 30650:650
$ kill -9 37260
$ pachctl port-forward & #works as expected now

      

Also, kill -9 in process pachctl port-forward

37245 doesn't work, it seems like I need to kill -9 onkubectl port-forward

+4


source to share


2 answers


You can specify the port, if you like, like another using a flag -p

as stated in the docs Is there any reason not to do this?

Also starting processes in the background and then dispatching it SIGKILL

causes resources to be unallocated properly, so when you try to attach to it you can see that it gives errors as it cannot assign the same port again. So try running it without &

at the end.



Therefore, whenever you change the context, all you have to do is CTRL + C

run it again, this will allow the resources to be freed up correctly and obtained.

+3


source


I just wanted to update this answer for anyone who finds it - pachctl

now supports contexts, and the Pachyderm context includes a link to its associated context kubectl

. When you switch to a new context pachctl

, pachctl

will now automatically use the associated context kubectl

(you still have to switch contexts in kubectl

)



0


source







All Articles