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
# Install and configure the dependencies for Mac OS | |
# Dependencies: virtualbox, minikube, kubernetes-helm, bash-completion | |
sh install.sh |
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
# Download the helm chart from mongodb-enterprise-kubernetes GitHub repo | |
wget -O master.zip https://github.com/mongodb/mongodb-enterprise-kubernetes/archive/master.zip | |
unzip master.zip | |
# Initialize the helm and helm chart | |
helm init --upgrade | |
helm install mongodb-enterprise-kubernetes-master/helm_chart/ --name mongodb-enterprise |
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
# If helm is not available | |
# Install the enterprise operator via YAML | |
kubectl apply -f mongodb-enterprise-kubernetes-master/mongodb-enterprise.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_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>" |
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
# 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
# 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
# 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
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
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 |