A CLI app which establishes a connection to a private Google Cloud Redis instance and port-forwards it to a local machine.
Connection is established by running an stunnel pod in a Google Kubernetes Engine cluster which runs in the same VPC network as the private Cloud Redis instance. Connection is then port-forwarded to the local machine, where a user can connect to the instance on localhost. Configurations in the app can be saved for practical future usage.
The app relies on local gcloud
and kubectl
commands which have to be configured and authenticated with the proper Google Cloud user and GKE Kubernetes cluster.
The app also needs an existing Kubernetes Secret containing the Google Cloud Redis certificate to exist in the Kubernetes
cluster. You can download a Redis certificate file and create a Kubernetes secret manually, or you can use
google-cloud-redis secrets create
command to do so.
Download a corresponding distribution from Releases and add
the executable to your PATH
.
# Help
google-cloud-redis help
# Create Kubernetes secret containing Gogle Cloud Redis certificate
google-cloud-redis secrets create
# Create (or override existing) configuration
google-cloud-redis configurations create
# Run configuration (interactive mode)
google-cloud-redis configurations run
# Run configuration (non-interactive mode)
google-cloud-redis configurations run $NAME
# HINT: Add alias
alias myDbProd="google-cloud-redis configurations run $NAME"
## Connect to the instance on localhost
redis-cli -p $LOCAL_PORT
# Export configurations (and share :-])
cat $(google-cloud-redis configurations path)
To deploy a new version of google-cloud-redis
app, manually run a "Continuous Deployment" worklow in GitHub Actions.