github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/mongodb-cluster/templates/NOTES.txt (about)

     1  ** Please be patient while the chart is being deployed **
     2  
     3  To get MongoDB connection address accessed from within your cluster:
     4  
     5      export MONGODB_ADDRESS=$(kubectl get secret --namespace {{ .Release.Namespace }} -l app.kubernetes.io/managed-by=kubeblocks,app.kubernetes.io/instance={{ .Release.Name }} -o jsonpath="{.items[0].data.headlessEndpoint}" | base64 -d)
     6  
     7  To get the root password run:
     8  
     9      export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} -l app.kubernetes.io/managed-by=kubeblocks,app.kubernetes.io/instance={{ .Release.Name}} -o jsonpath="{.items[0].data.password}" | base64 -d)
    10  
    11  To connect to your database, create a MongoDB client container:
    12  
    13      kubectl run --namespace {{ .Release.Namespace }} {{ .Release.Name }}-client --rm --tty -i --restart='Never' --env="MONGODB_ROOT_PASSWORD=$MONGODB_ROOT_PASSWORD" --env="MONGODB_ADDRESS=$MONGODB_ADDRESS" --image mongo:5.0.14 --command -- bash
    14  
    15  Then, run the following command:
    16  
    17      mongosh admin --host $MONGODB_ADDRESS --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD
    18