omrikiei / ktunnel

A cli that exposes your local resources to kubernetes
GNU General Public License v3.0
913 stars 71 forks source link

Support injection for applications with statefulset but no deployment. #91

Open snyderpa-owl opened 1 year ago

snyderpa-owl commented 1 year ago

I have a fairly simple use-case but struggling to work out the series of commands to make this happen. In a dev environment with several namespaces each serving a php web app declared using a statefulset configuration, I want to reverse forward port 9003 to my local xdebug client. I expect

ktunnel inject deployment <name_of_statefulset> 9003 -v
INFO[0000] Injecting tunnel sidecar to default/owl-app  
FATA[0001] failed injecting sidecar: deployments.apps "owl-app" not found 

to use the existing statefulset or for ktunnel to provide an ktunnel inject statefulset command.

If there is a workaround or a supported way to accomplish this, help would be appreciated.

Thanks.

omrikiei commented 1 year ago

Hi @snyderpa-owl, the current implementation doesn't support injecting to StatefulSets, what you can do is expose a service with the port with the ktunnel expose and then direct your php application's xdebug remote host to the address of the exposed service

snyderpa-owl commented 1 year ago

Thanks @omrikiei here is what I am trying -- can you help me get past this?

% ktunnel expose -v xdebug 9003:9003
FATA[0001] Failed to expose local machine as a service: error creating deployment 
% ktunnel expose -v xdebug 9003     
FATA[0001] Failed to expose local machine as a service: error creating deployment 

I am able to create a simple deployment using kubectl apply so I can confirm I have correct auth and kube installation.

omrikiei commented 1 year ago

@snyderpa-owl which k8s version are you using? I want to try and replicate this

snyderpa-owl commented 1 year ago

Connected to an AWS EKS cluster I am using this:

% kubectl version  
Client Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.6-eks-7d68063", GitCommit:"f24e667e49fb137336f7b064dba897beed639bad", GitTreeState:"clean", BuildDate:"2022-02-23T19:32:14Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"23+", GitVersion:"v1.23.13-eks-fb459a0", GitCommit:"55bd5d5cb7d32bc35e4e050f536181196fb8c6f7", GitTreeState:"clean", BuildDate:"2022-10-24T20:35:40Z", GoVersion:"go1.17.13", Compiler:"gc", Platform:"linux/amd64"}
testifyqa commented 1 year ago

Any updates on this I need something similar for a DaemonSet

sfc-gh-plis commented 9 months ago

That would make sense for my use-case as well