Debugging a rails application in Minikube Debugging a rails application in Minikube kubernetes kubernetes

Debugging a rails application in Minikube


You are trying to get interactive access to your application.

Your problem is caused by the fact that the k8s does not allocate a TTYand stdin buffer for the container by default.

I have replicated your issue and found a solution.

To get an interactive breakpoint you have to add 2 flags to your Deployment yaml to indicate that you need interactive session:

   stdin: true   tty: true

Here is an example of a deployment:

   apiVersion: apps/v1   kind: Deployment   metadata:     labels:       run: test     name: test   spec:     selector:       matchLabels:         run: test     template:       metadata:         labels:           run: test       spec:         containers:         - image: test           name: test           stdin: true           tty: true

You can find more info about it here.

Remember to use -it option when attaching to pod, like shown below:

   kubectl attach -it <pod_name>

Let me know if that helped.