DEV Community

Lucian Ghinda
Lucian Ghinda

Posted on • Originally published at allaboutcoding.ghinda.com

How to open rails console in safe mode on GCP k8s

Here is how to open rails console in safe mode on GCP k8s.

First you need to list the pods:

kubectl get pods | grep <name>
Enter fullscreen mode Exit fullscreen mode

replace with the name of the pod that you want to connect with rails console.
In the list that you see copy the name of one of the pods.

Then you can execute

kubectl exec <pod_name> -i -t -- rails c --sandbox
Enter fullscreen mode Exit fullscreen mode

This will open your rails console in sandbox mode.

*Futher read: *

  1. Read here more about rails console with sandbox.

  2. Directly execute locally rails console --help to see all available options.


This works so far up until and including Rails 6. Did not tested this yet on Rails 7.

Top comments (0)