Video : https://www.youtube.com/watch?v=vmIOCYZRZu4&t=2908s
Slides from Jason Mimicks presentation at the June 2018 Chicago Kubernetes Meetup - video here : https://youtu.be/vmIOCYZRZu4?t=48m28s
3. Agenda
❖ Running data services today
❖ The New MongoDB Enterprise Kubernetes Operator
❖ Using MongoDB on Kubernetes
❖ Preview of coming attractions
4. 4
Data as a service?
Evolution
The Big Bang
Libraries
Card Catalog
Computers
On Demand & Self-service
Cloud Ready
Highly Available
Secure
Databases
Relational &
Normalization
note: not drawn to scale
5. 5
TODAY
Disclaimer
Dev+Ops
Everyone is a bit DBA
• Continuous. Check in a fix - goes to production.
• Knowing how your app uses data is crucial. Deep telemetry and insight into your
database is essential.
• As much as you love bash, you'll never scale without end-to-end tooling
8. Architecture
supervisord Automation Agent
Backup Agent Monitoring Agent
Deployed by the Automation Agent into the
Container afterwards
The MongoDB Enterprise
Container
Included in the Container Image
Ops Manager Kubernetes
z
Mongo Container
z
Mongo Container
z
Mongo Container
AppDB
Kubectl / k8s API
MongoDB
Kubernetes
Operator
9. How it all works (demo env)
ConfigMap
OpsMgr Url
OpsMgr Project
Secret
OpsMgr
Credentials
Pod
Pod
⚙
⚙
⚙
StatefulSet
---
apiVersion: mongodb.com/v1
kind: MongoDbReplicaSet
metadata:
name: my-replica-set
namespace: mongodb
spec:
members: 3
version: 3.6.5
project: my-project
credentials: my-credentials
MongoDB
Ops
Manager
OpsMgr
AppDB
MongoDB
Enterprise
Operator
kube-api
HTTP
HTTP
10. # Start cluster
minikube start --memory="12000" --bootstrapper kubeadm
# Install operator
helm init
helm install ./mongodb-enterprise-kubernetes/helm_chart
--name mongodb-enterprise
# set default namespace (op installs to 'mongodb')
kubectl config set-context $(kubectl config current-context)
--namespace=mongodb
# See all operator stuff
kubectl get all --selector=app=mongodb-enterprise-operator
# … install/access MongoDB Ops Manager
Demo - Setup - Installing the Operator
14. kubectl get all --selector=app=chicago-meetup-replset-svc
NAME READY STATUS RESTARTS AGE
pod/chicago-meetup-replset-0 1/1 Running 0 14m
pod/chicago-meetup-replset-1 1/1 Running 0 14m
pod/chicago-meetup-replset-2 1/1 Running 0 14m
NAME TYPE CLUSTER-IP
EXTERNAL-IP PORT(S) AGE
service/chicago-meetup-replset-svc ClusterIP None <none>
27017/TCP 14m
service/chicago-meetup-replset-svc-external NodePort 10.110.13.232 <none>
27017:31252/TCP 14m
NAME DESIRED CURRENT AGE
statefulset.apps/chicago-meetup-replset 3 3 14m
Demo - What's running
17. Demo - connecting your app - mongodb+srv//:
➜ kubectl run test --image=tutum/dnsutils --
host -t srv chicago-meetup-replset-svc
deployment.apps "test" created
➜ kubectl logs test-6b59b4689d-4sws6
chicago-meetup-replset-svc.mongodb.svc.cluster.local has SRV record 10 33 0
chicago-meetup-replset-0.chicago-meetup-replset-svc.mongodb.svc.cluster.local.
chicago-meetup-replset-svc.mongodb.svc.cluster.local has SRV record 10 33 0
chicago-meetup-replset-1.chicago-meetup-replset-svc.mongodb.svc.cluster.local.
chicago-meetup-replset-svc.mongodb.svc.cluster.local has SRV record 10 33 0
chicago-meetup-replset-2.chicago-meetup-replset-svc.mongodb.svc.cluster.local.
18. Demo - connecting your app - mongodb+srv//:
➜ kubectl run conntester --restart=Never --image=simple-mongodb-connection-tester
"mongodb+srv://chicago-meetup-replset-svc.mongodb.svc.cluster.local/?ssl=false"
pod "conntester" created
➜ kubectl logs conntester
simple-connection-test: testing connection to
mongodb+srv://chicago-meetup-replset-svc.mongodb.svc.cluster.local/?ssl=false
Creating and reading 100 docs in the 'test-1f1aab0a.foo' namespace
Database(MongoClient(host=['chicago-meetup-replset-0.chicago-meetup-replset-svc.mongod
l:27017', 'chicago-meetup-replset-2.chicago-meetup-replset-svc.mongodb.svc.cluster.loc
'chicago-meetup-replset-1.chicago-meetup-replset-svc.mongodb.svc.cluster.local:27017']
document_class=dict, tz_aware=False, connect=True, ssl=False), u'test-1f1aab0a')
{u'i': 0, u'_id': ObjectId('5b2c07e92bc77a00017ee7c5')}
…
{u'i': 99, u'_id': ObjectId('5b2c07ea2bc77a00017ee828')}
Dropped db 'test-1f1aab0a'
19. Full example - ReplicaSet
https://raw.githubusercontent.com/10gen/ops-manager-kubernetes/ead26a54f284d1d1
361c90cce71993089bc1fe0f/samples/extended/om-replica-set.yaml?token=AAEanrYfl-
uB7oBq5xJyrtlK0ZvweoiBks5bNR9twA%3D%3D
More advanced configurations:
● Resources
○ CPU
○ Memory
○ Storage
● Node affinity
20. Coming attractions….
Coming features before GA
● Evolving Production Notes to support containers
● TLS
○ Configure certs inside containers and also
MongoDB security
● Auth/Authz
○ Tight integration with supported MongoDB
authentication mechanisms
■ x509
■ LDAP/Kerberos
● Dynamic cluster changes
○ Adding nodes to replica sets
○ Converting replica set to sharded cluster
● Backups enabled by default
21. Coming attractions….
● Support for Kubernetes distributions
○ OpenShift template: example
○ PKS
○ GKE, Amazon ECS, Azure Container Service
○ … more - let us know!
22. Learn and join the
MongoDB Enterprise Kubernetes
Community
Public launch at MongoDB World next week!
Github: https://github.com/mongodb/mongodb-enterprise-kubernetes
Slack: https://launchpass.com/mongo-db #enterprise-kubernetes
Thanks!