Created
February 22, 2019 03:31
-
-
Save jamesholcomb/1a1d968d3e3bdd7d80060090ecc122bf to your computer and use it in GitHub Desktop.
outputs the mongodb replica set master host name in a Kubernetes cluster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl exec db-mongodb-replicaset-0 -- sh -c 'mongo --quiet --eval="printjson(rs.isMaster().primary)"' | sed 's/"//g' | awk -F\. '{print $1}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment