How to open rails console in safe mode on GCP k8s
·Nov 23, 2021·
1 min read
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>
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
This will open your rails console in sandbox mode.
Read here more about rails console with sandbox.
Directly execute locally
rails console --helpto see all available options.
This works so far up until and including Rails 6. Did not tested this yet on Rails 7.