This file contains 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
# delete the existing pod after fixing the issue | |
kubectl -n mongodb delete pod $K8_OPERATOR_POD_NAME | |
sleep 5 | |
# display all the resources in the namespace | |
kubectl -n ${K8_NAMESPACE} get all |
This file contains 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
# find the pod name for mongodb-enterprise-operator using selectors | |
K8_OPERATOR_POD_NAME=$(kubectl -n mongodb get pods --selector=app=mongodb-enterprise-operator --output=jsonpath='{.items[0].metadata.name}') | |
# display the mongodb-enterprise-operator logs from mongodb namespace | |
kubectl -n mongodb logs $K8_OPERATOR_POD_NAME |
This file contains 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 delete -f samples/${K8_NAMESPACE}-replicaset.yaml |
This file contains 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 -n ${K8_NAMESPACE} describe pod/mongodb-world-replicaset-0 | grep 'Node:' | |
# Node: 10.128.0.7 | |
kubectl -n ${K8_NAMESPACE} get services | |
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE | |
# mongodb-world-replicaset-svc ClusterIP None <none> 27017/TCP 41m | |
# mongodb-world-replicaset-svc-external NodePort 10.43.252.153 <none> 27017:31750/TCP 41m | |
mongo --host 10.128.0.7 --port 31750 | |
# MongoDB shell version v3.6.5 | |
# connecting to: mongodb://mongodb-world-replicaset-0:27017/ | |
# MongoDB server version: 3.6.5 |
This file contains 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 -n ${K8_NAMESPACE} exec -it ${K8_NAMESPACE}-replicaset-0 -- bin/bash | |
# mongodb@mongodb-world-replicaset-0:/$ | |
/var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.6.5/bin/mongo | |
# MongoDB shell version v3.6.5 | |
# connecting to: mongodb://mongodb-world-replicaset-0:27017/ | |
# MongoDB server version: 3.6.5 | |
# mongodb-world-replicaset:PRIMARY> |
This file contains 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
# mongodb-world-replicaset.yaml contents | |
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: "mongodb-world" | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: |
This file contains 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
# display all the resources in the namespace | |
kubectl -n $K8_NAMESPACE get all | |
# NAME READY STATUS RESTARTS AGE | |
# pod/mongodb-world-replicaset-0 1/1 Running 0 4m | |
# pod/mongodb-world-replicaset-1 1/1 Running 0 4m | |
# pod/mongodb-world-replicaset-2 1/1 Running 0 4m | |
# | |
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) # AGE | |
# service/mongodb-world-replicaset-svc ClusterIP None <none> 27017/TCP # 4m | |
# service/mongodb-world-replicaset-svc-external NodePort 10.43.252.153 <none> # 27017:31750/TCP 4m |
This file contains 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
# create the YAML file using the template | |
sh templates/generate-yaml-simple-replicaset.sh | |
# create the replica set based on the generated YAML | |
source templates/environment.sh | |
kubectl apply -f samples/${K8_NAMESPACE}-replicaset.yaml |
This file contains 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
OM_URL="https://cloud.mongodb.com/" | |
K8_NAMESPACE="mongodb-world" | |
MONGODB_VERSION="3.6.5" |
This file contains 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
OM_PROJECT_ID="<opsmanager_project_id>" | |
OM_USER_BASE64=$(echo "<opsmanager_userid>" | base64) | |
OM_API_KEY_BASE64=$(echo "<opsmanager_public_apikey>" | base64) | |
OM_URL="<opsmanager_uri>" | |
K8_NAMESPACE="<kubernetes_namespace>" | |
MONGODB_VERSION="<mongodb_version>" |