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
Then you can execute
kubectl exec <pod_name> -i -t -- rails c --sandbox
This will open your rails console in sandbox mode.
**Futher read: **
Read here more about rails console with sandbox.
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.