Running an Image on Kubernetes With an Interactive Shell

- - posted in ethereum, geth, k8s, kubernetes | Comments

If you have an existing kubernetes cluster that you are using you may need to get a shell running from inside that cluster to help you debug things. In my scenario access to an ethereum client was locked down to only allow access from the cluster IP address.

Run a geth client on kubernetes

1
kubectl run --namespace default geth --rm --tty -i --image ethereum/client-go --command /bin/sh

This will give you a command promt so that you can geth attach http://node-address.com

Run a mongo client on kubernetes

1
2
3
kubectl run --namespace default mongo-client --rm --tty -i --image bitnami/mongodb --command -- \ 

mongo admin --host mongo.db.hostname --authenticationDatabase admin -u root -p password

Port forward from a kubernetes cluster to your local machine

Sometimes you want to run some local tools but connect to soemthing in the cluster, eg connect to a mongo db running in kubernetes.

1
kubectl port-forward --namespace default svc/mongo-mongodb 27017:27017

k8s Docs

Comments