PHP debugging with Kubernetes on WSL

We recently switched from Docker to Kubernetes. With Docker it is possible to run a debugger by setting up the CLI to run the PHP container through the Docker API. With Kubernetes there is no such API and additionally Windows users us Ubuntu on WSL to have the same workflow as other developers working on a Unix system. Because with minikube we no longer require Docker, not every developer has that installed anymore. 

Is there some way to enable a connection between PHPStorm and the local Kubernetes cluster so that we are able to run a CLI interpreter for debugging again? 

0

Is there some way to enable a connection between PHPStorm and the local Kubernetes cluster so that we are able to run a CLI interpreter for debugging again?

Unfortunately, no, there's no support for Kubernetes in PhpStorm: https://youtrack.jetbrains.com/issue/WI-43032

The only option here is that you expose the container's SSH to the host.

0
Avatar
Permanently deleted user

How would you go about that? I can't get it to work on my local machine. Hopefully I'm approaching it the wrong way. I have tried the following:

  1. Added ssh support in the image (openssh with root access and password enabled, connection from other containers are possible with this).
  2. Tried to connect to the  Cluster-IP address of the pod on my local machine (shouldn't work, but was worth a try)
  3. I added a seperate service with type LoadBalancer and forwarding of port 22. This doesn't work because with a local kubecluster (minikube) this type is not supported, so no IP address is provided (keeps returning a pending state)
  4. Exposed port 22 in the container service. Then I tried adding the container to Ingress with a hostname (ssh.my-dev-domain.local) and forward request to port 22 in the container. It then directly closes the connection without handling the request.

I am currently all out of ideas. Could you help me out here?

It would be more convenient if it would be able to run it through kubectl with the name of the service. Any idea when support will be added?

0
Avatar
Permanently deleted user

I figured it out. Instead of the exposed port you need to use the assigned NodePort or the ssh-server should be injected as side-car. For now we moved with the NodePort approach and specified the port number in the manifest, but a future release of Okteto will enable ssh login on a specifyable port number.

2

请先登录再写评论。