useful commands for ops inside k8s
← back to notes
Start a pod with psql installed for connecting to a postgres instance:
1$ k run -n postgres -it --rm psql-client --image=postgres --restart=Never -- bash
2$ psql -h "postgres.posgres.svc.cluster.local" -U "admin" -d "db"
Start a pod with redis-cli installed for connecting to a redis instance:
1# Start a redis container
2$ kubectl run -n redis --rm -it --image=redis redis-cli -- bash
3$ redis-cli -h redis.redis.svc.cluster.local -p 6379