Lucian
Random Thoughts about Building Software

Random Thoughts about Building Software

How to open rails console in safe mode on GCP k8s

Lucian's photo
Lucian
·Nov 23, 2021·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

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.

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.

 
Share this