SlideShare a Scribd company logo
How to Deploy and Manage
MongoDB in Kubernetes
James Broadhead
Director of Ops Manager & Cloud Developer
Productivity
Demo
I’m a developer, I want a mongod...
Agenda (Intro Demo)
What are Kubernetes, Operators & Ops
Manager?
Introducing the MongoDB Enterprise Operator
Demo: Deploying a Sharded Cluster
Examples: Operational Tasks with the Operator
Demo: Resiliency after Failure
Download / Contact info
40 minutes
… but mainly these questions ...
There are many ways to
deploy apps and MongoDB on
Kubernetes...
There are many ways to
deploy apps and MongoDB
on Kubernetes
Why do I need an Operator?
… but mainly these questions ...
There are many ways to
deploy apps and MongoDB
on Kubernetes
Why do I need an Operator?
Why should I use the
MongoDB Enterprise Operator?
… but mainly these questions ...
As an Operations / DevOps engineer
The Operator will make your life easier
Fewer manual tasks, more automated failure recovery
Skip straight to the answers!
As an Operations / DevOps engineer
The Operator will make your life easier
Fewer manual tasks, more automated failure recovery
As a Developer
Your company can provide MongoDB as a Service
Easy access to production-ready MongoDB with a single click
or command
Skip straight to the answers!
What is Kubernetes?
Definition
Kubernetes is an open-source container-orchestration system for automating deployment, scaling
and management of containerized applications.
It was originally designed by Google and is now maintained by the Cloud Native Computing
Foundation
Definition
Kubernetes is an open-source container-orchestration system for automating deployment, scaling
and management of containerized applications.
It was originally designed by Google and is now maintained by the Cloud Native Computing
Foundation
Containers
Isolated environments in which you can run your software
• Apps ship with their dependencies and configuration bundled in a container Image
• Less overhead than Virtual Machines
• eg. Docker / rkt for Kubernetes
• but many alternatives
Definition
Kubernetes is an open-source container-orchestration system for automating deployment, scaling
and management of containerized applications.
It was originally designed by Google and is now maintained by the Cloud Native Computing
Foundation
Orchestration: Kubernetes primitives
• Pod - the smallest deployable unit of
computing in Kubernetes. Contains
1 or more containers. A pod models
an application-specific “logical host”
• (Kubernetes) ReplicaSet -
guarantees a certain number of pods
are running with a given
configuration
• Deployment - abstraction layer over
ReplicaSets
nginx-0 nginx-1
nginx-2
Orchestration: Features
• Replacement - pods which die get
rescheduled on a new node. It’s fast!
• Consistent, Predictable Hostnames -
if your pod gets rescheduled, Kube
dns will be updated, so your app can
reconnect (Statefulset)
• Affinity Rules - configure how close
together your instances are.
• Same host? Same rack? Same
Availability Zone?
nginx-0 nginx-1
nginx-2
Config Example
I need to deploy a stateless app
(nginx)
Nginx Example
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
Nginx Example
host$ kubectl apply -f ngnix.yaml
deployment "nginx-deployment" created
Results
host$ kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
nginx-deployment 2 2 2 2 53s
Results
host$ kubectl get pods
NAME READY STATUS RESTARTS
AGE
nginx-deployment-75675f5897-cbn5t 1/1 Running 0 5m
nginx-deployment-75675f5897-tv8pf 1/1 Running 0 5m
Scaling
host$ kubectl scale deployment nginx-deployment --replicas=3
deployment "nginx-deployment" scaled
Scaling
host$ kubectl get pods
NAME READY STATUS RESTARTS
AGE
nginx-deployment-75675f5897-cbn5t 1/1 Running 0 7m
nginx-deployment-75675f5897-tv8pf 1/1 Running 0 7m
nginx-deployment-75675f5897-ftf9q 0/1 ContainerCreating 0
26s
What is
MongoDB Ops Manager?
Ops Manager - Monitoring, Automation
and Backup
MongoDB Ops Manager makes it fast and
easy for you to deploy, monitor, upgrade, back
up and scale your MongoDB deployment
Ops Manager - Monitoring
Ops Manager - Automation
● Point-In-Time Recovery
● Continuous, Incremental Backups
● Queryable backups
Ops Manager - Backup
Cloud Manager
What are
Kubernetes Operators?
Operators
• Deploying and scaling stateless apps like nginx is easy
Operators
• Deploying and scaling stateless apps like nginx is easy
• Deploying stateful applications - like databases - is more
complicated. We’ll need more Kubernetes objects to be created
and managed together, and there’s more to do to update
versions, scale or organise backups
Operators
• Deploying and scaling stateless apps like nginx is easy
• Deploying stateful applications - like databases - is more
complicated. We’ll need more Kubernetes objects to be created
and managed together, and there’s more to do to update
versions, scale or organise backups
• Operators are a way to add application-specific awareness to
Kubernetes, so you can automate these complex tasks while
taking advantage of Kubernetes Orchestration.
Operators
• Deploying and scaling stateless apps like nginx is easy
• Deploying stateful applications - like databases - is more
complicated. We’ll need more Kubernetes objects to be created
and managed together, and there’s more to do to update
versions, scale or organise backups
• Operators are a way to add application-specific awareness to
Kubernetes, so you can automate these complex tasks while
taking advantage of Kubernetes Orchestration.
⟶ You can teach Kubernetes about MongoDB!
Introducing the
MongoDB Enterprise Kubernetes
Operator
MongoDB Enterprise Kubernetes
Operator
An application that allows you to create and manage MongoDB
deployments in Kubernetes cluster with the help of Ops Manager
or Cloud Manager
• Quick, declarative definition of what MongoDB services you
want
• Auto-healing, using Kubernetes reliability features
• Easy to scale up / scale down
Architecture (1)
Architecture (2)
Architecture (3)
Architecture (4)
Architecture (5)
Use Case
Deploying a Sharded Cluster
Sharded Clusters
Ways to deploy a Sharded Cluster
Ways to deploy a Sharded Cluster
Atlas!
Ways to deploy a Sharded Cluster
Manually?
Ways to deploy a Sharded Cluster?
Manually!
https://docs.mongodb.com/manual/tutorial/deploy-shard-cluster/
➔ Time-consuming
➔ Manual management is risky and unreliable
➔ Not reproducible - would need to write your own
automation code
◆ Puppet / Chef / Ansible
Using Ops Manager
Ways to deploy a Sharded Cluster?
Using Ops Manager
● Automation! … but
○ Have to configure hardware each time,
and install and configure Automation
Agents (chef / puppet)
○ Need to trigger failure-recovery in Ops
Manager
○ Repeatability - must use APIs
Ways to deploy a Sharded Cluster?
What if there was a way that …
• Could provision hardware from a pool whenever needed
• Could recover from failure by requesting new hardware
resources
• Could easily scale your clusters horizontally or vertically
Ways to deploy a Sharded Cluster?
What if there was a way that …
• Could provision hardware from a pool whenever needed
• Could recover from failure by requesting new hardware
resources
• Could easily scale your clusters horizontally or vertically
• Declaratively defined deployment config
• Easy to deploy similar configurations / topologies
Ways to deploy a Sharded Cluster?
Demo
Deploying a Sharded Cluster
with the MongoDB Enterprise Operator
Examples
Operational Tasks
MongoDB version upgrade
apiVersion: mongodb.com/v1
kind: MongoDbShardedCluster
metadata:
name: my-sharded-cluster
namespace: mongodb
spec:
shardCount: 2
mongodsPerShardCount: 3
mongosCount: 2
configServerCount: 3
version: 4.0.0-ent
project: demo-project
credentials: demo-credentials
persistent: false
MongoDB version upgrade
apiVersion: mongodb.com/v1
kind: MongoDbShardedCluster
metadata:
name: my-sharded-cluster
namespace: mongodb
spec:
shardCount: 2
mongodsPerShardCount: 3
mongosCount: 2
configServerCount: 3
version: 4.0.0-ent
project: demo-project
credentials: demo-credentials
persistent: false
apiVersion: mongodb.com/v1
kind: MongoDbShardedCluster
metadata:
name: my-sharded-cluster
namespace: mongodb
spec:
shardCount: 2
mongodsPerShardCount: 3
mongosCount: 2
configServerCount: 3
version: 4.0.0-ent
project: demo-project
credentials: demo-credentials
persistent: false
Horizontal Scaling
apiVersion: mongodb.com/v1
kind: MongoDbShardedCluster
metadata:
name: my-sharded-cluster
namespace: mongodb
spec:
shardCount: 2
mongodsPerShardCount: 3
mongosCount: 2
configServerCount: 3
version: 4.0.0
project: demo-project
credentials: demo-credentials
persistent: false
Horizontal Scaling
apiVersion: mongodb.com/v1
kind: MongoDbShardedCluster
metadata:
name: my-sharded-cluster
namespace: mongodb
spec:
shardCount: 2
mongodsPerShardCount: 3
mongosCount: 2
configServerCount: 3
version: 4.0.0
project: demo-project
credentials: demo-credentials
persistent: false
apiVersion: mongodb.com/v1
kind: MongoDbShardedCluster
metadata:
name: my-sharded-cluster
namespace: mongodb
spec:
shardCount: 3
mongodsPerShardCount: 5
mongosCount: 10
configServerCount: 3
version: 4.0.0
project: demo-project
credentials: demo-credentials
persistent: false
Vertical Scaling
...
spec:
...
mongosPodSpec:
cpu: '0.8'
memory: 1G
shardPodSpec:
cpu: '2'
memory: 10G
configSrvPodSpec:
cpu: '1'
memory: 7G
Vertical Scaling
...
spec:
...
mongosPodSpec:
cpu: '0.8'
memory: 1G
shardPodSpec:
cpu: '2'
memory: 10G
configSrvPodSpec:
cpu: '1'
memory: 7G
...
spec:
...
mongosPodSpec:
cpu: '0.8'
memory: 1G
shardPodSpec:
cpu: '4'
memory: 20G
configSrvPodSpec:
cpu: '1'
memory: 7G
Scaling / Performance: Storage Hardware
Control PersistentVolumeClaims
...
spec:
...
configSrvPodSpec:
storage: 5Gi
storageClass: standard
shardPodSpec:
storage: 25Gi
storageClass: fast
Scaling / Performance: Storage Hardware
Control PersistentVolumeClaims
...
spec:
...
configSrvPodSpec:
storage: 5Gi
storageClass: standard
shardPodSpec:
storage: 25Gi
storageClass: fast
...
spec:
...
shardPodSpec:
storage: 25Gi
storageClass: fast
labelSelector:
matchExpressions:
- {key: diskGroup,
operator: In,
values: [shardDisks]}
Fault Tolerance: Distributing replicas
By default Operator ensures that all members of one replica set are
distributed to different nodes
It’s possible to change this and spread them to different availability
zones:
configSrvPodSpec:
podAntiAffinityTopologyKey: failure-domain.beta.kubernetes.io/zone
A common deployment is to co-locate the mongos process on application
servers, which allows for local communication between the application and
the mongos process.
https://www.mongodb.com/collateral/mongodb-performance-best-practices
Performance: Co-locate mongos pods
with App
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-server
spec:
selector:
matchLabels:
app: web-store
replicas: 3
template:
metadata:
labels:
app: web-store
...
Performance: Co-locate mongos pods with
App
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-server
spec:
selector:
matchLabels:
app: web-store
replicas: 3
template:
metadata:
labels:
app: web-store
...
apiVersion: mongodb.com/v1
kind: MongoDbShardedCluster
...
spec:
...
mongosPodSpec:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- web-store
topologyKey: "kubernetes.io/hostname"
Performance: Co-locate mongos pods with
App
High availability - Replacement
• Kubernetes will do its best to match the real state with desired state
• If one pod fails, Kubernetes will start another one
• The Kubernetes Statefulset primitive will preserve the hostname of the pod, even if
scheduled to a different machine
• So your MongoDB Driver will be able to connect easily
• MongoDB replication will make sure that the new replica catches up
• The same PersistentVolume will be mounted, so recovery should be fast
Demo
Fault Tolerance
As an Operations / DevOps engineer
The Operator will make your life easier
Fewer manual tasks, more automated failure recovery
As a Developer
Your company can provide MongoDB as a Service
Easy access to production-ready MongoDB with a single click
or command
So – why use the Operator?
Current state
• The Operator is in beta now – v.0.4
github.com/mongodb/mongodb-enterprise-kubernetes
• We are actively collecting customer and community
feedback and building features
community-slack.mongodb.com #enterprise-
kubernetes
• If you have a Kubernetes environment, it’s
available for download & pre-production use now.
Thanks for listening!
Questions?
Ask at the Cloud Booth,
or in the Community Slack!
community-slack.mongodb.com

More Related Content

What's hot (19)

PPTX
MongoDB 3.4 webinar
Andrew Morgan
 
PPTX
What's new in MongoDB 2.6
Matias Cascallares
 
PDF
Build Your Kubernetes Operator with the Right Tool!
Rafał Leszko
 
PDF
Distributed Logging Architecture in Container Era
SATOSHI TAGOMORI
 
PDF
Vitalii Bondarenko HDinsight: spark. advanced in memory big-data analytics wi...
Аліна Шепшелей
 
PDF
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
MongoDB
 
PPTX
Running MongoDB 3.0 on AWS
MongoDB
 
PDF
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
MongoDB
 
PDF
MongoDB .local Bengaluru 2019: Lift & Shift MongoDB to Atlas
MongoDB
 
PPTX
An Introduction to MongoDB Ops Manager
MongoDB
 
PDF
How We Fixed Our MongoDB Problems
MongoDB
 
PPTX
HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...
Michael Stack
 
PDF
MongoDB .local Bengaluru 2019: Becoming an Ops Manager Backup Superhero!
MongoDB
 
PDF
Presto in the cloud
Qubole
 
PPTX
Experian Health: Moving Universal Identity Manager from ANSI SQL to MongoDB
MongoDB
 
PDF
Making KVS 10x Scalable
Sadayuki Furuhashi
 
PDF
Kubernetes Forum Seoul 2019: Re-architecting Data Platform with Kubernetes
SeungYong Oh
 
PDF
Spark day 2017 - Spark on Kubernetes
Yousun Jeong
 
ZIP
Constructing Web APIs with Rack, Sinatra and MongoDB
Oisin Hurley
 
MongoDB 3.4 webinar
Andrew Morgan
 
What's new in MongoDB 2.6
Matias Cascallares
 
Build Your Kubernetes Operator with the Right Tool!
Rafał Leszko
 
Distributed Logging Architecture in Container Era
SATOSHI TAGOMORI
 
Vitalii Bondarenko HDinsight: spark. advanced in memory big-data analytics wi...
Аліна Шепшелей
 
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
MongoDB
 
Running MongoDB 3.0 on AWS
MongoDB
 
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
MongoDB
 
MongoDB .local Bengaluru 2019: Lift & Shift MongoDB to Atlas
MongoDB
 
An Introduction to MongoDB Ops Manager
MongoDB
 
How We Fixed Our MongoDB Problems
MongoDB
 
HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...
Michael Stack
 
MongoDB .local Bengaluru 2019: Becoming an Ops Manager Backup Superhero!
MongoDB
 
Presto in the cloud
Qubole
 
Experian Health: Moving Universal Identity Manager from ANSI SQL to MongoDB
MongoDB
 
Making KVS 10x Scalable
Sadayuki Furuhashi
 
Kubernetes Forum Seoul 2019: Re-architecting Data Platform with Kubernetes
SeungYong Oh
 
Spark day 2017 - Spark on Kubernetes
Yousun Jeong
 
Constructing Web APIs with Rack, Sinatra and MongoDB
Oisin Hurley
 

Similar to MongoDB Ops Manager and Kubernetes - James Broadhead (20)

PDF
MongoDB World 2019: Using the MongoDB Enterprise Kubernetes Operator to Scale...
MongoDB
 
PDF
MongoDB Ops Manager + Kubernetes
MongoDB
 
PPTX
Kubernetes-Presentation-Syed-Murtaza-Hassan
Syed Murtaza Hassan
 
PPTX
How kubernetes operators can rescue dev secops in midst of a pandemic updated
Shikha Srivastava
 
PPTX
Kubernetes: від знайомства до використання у CI/CD
Stfalcon Meetups
 
PDF
A Deeper Look Into How Kubernetes Works.pdf
PetaBytz Technologies
 
PDF
MongoDB World 2019: Mastering MongoDB in Kubernetes
MongoDB
 
PDF
Kubernetes intro
Pravin Magdum
 
PDF
Download full Managing Kubernetes operating Kubernetes clusters in the real w...
duduhasikul
 
PPTX
Database as a Service (DBaaS) on Kubernetes
ObjectRocket
 
PPT
Kubernetes is a ppt of explanation of kubernet topics
tnmy4903
 
PPTX
kubernetesforbeginners.pptx
BaskarKannanK
 
PPTX
DevOps with Kubernetes
EastBanc Tachnologies
 
TXT
Introduction about Kubernates Cluster
♛Kumar Aneesh♛
 
PPTX
Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...
Uri Cohen
 
PDF
Kubernetes for Java developers
Robert Barr
 
PDF
Kubernetes for Beginners
DigitalOcean
 
PDF
Scalable Spark deployment using Kubernetes
datamantra
 
PPTX
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
Nati Shalom
 
PPTX
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...
Cloud Native Day Tel Aviv
 
MongoDB World 2019: Using the MongoDB Enterprise Kubernetes Operator to Scale...
MongoDB
 
MongoDB Ops Manager + Kubernetes
MongoDB
 
Kubernetes-Presentation-Syed-Murtaza-Hassan
Syed Murtaza Hassan
 
How kubernetes operators can rescue dev secops in midst of a pandemic updated
Shikha Srivastava
 
Kubernetes: від знайомства до використання у CI/CD
Stfalcon Meetups
 
A Deeper Look Into How Kubernetes Works.pdf
PetaBytz Technologies
 
MongoDB World 2019: Mastering MongoDB in Kubernetes
MongoDB
 
Kubernetes intro
Pravin Magdum
 
Download full Managing Kubernetes operating Kubernetes clusters in the real w...
duduhasikul
 
Database as a Service (DBaaS) on Kubernetes
ObjectRocket
 
Kubernetes is a ppt of explanation of kubernet topics
tnmy4903
 
kubernetesforbeginners.pptx
BaskarKannanK
 
DevOps with Kubernetes
EastBanc Tachnologies
 
Introduction about Kubernates Cluster
♛Kumar Aneesh♛
 
Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...
Uri Cohen
 
Kubernetes for Java developers
Robert Barr
 
Kubernetes for Beginners
DigitalOcean
 
Scalable Spark deployment using Kubernetes
datamantra
 
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
Nati Shalom
 
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...
Cloud Native Day Tel Aviv
 
Ad

More from MongoDB (20)

PDF
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB
 
PDF
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB
 
PDF
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB
 
PDF
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB
 
PDF
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB
 
PDF
MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB
 
PDF
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB
 
PDF
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB
 
PDF
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB
 
PDF
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB
 
PDF
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB
 
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB
 
PDF
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB
 
PDF
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB
 
PDF
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB
 
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB
 
PDF
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB
 
PDF
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB
 
PDF
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB
 
PDF
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB
 
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB
 
Ad

Recently uploaded (20)

PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Human Resources Information System (HRIS)
Amity University, Patna
 

MongoDB Ops Manager and Kubernetes - James Broadhead

  • 1. How to Deploy and Manage MongoDB in Kubernetes James Broadhead Director of Ops Manager & Cloud Developer Productivity
  • 2. Demo I’m a developer, I want a mongod...
  • 3. Agenda (Intro Demo) What are Kubernetes, Operators & Ops Manager? Introducing the MongoDB Enterprise Operator Demo: Deploying a Sharded Cluster Examples: Operational Tasks with the Operator Demo: Resiliency after Failure Download / Contact info 40 minutes
  • 4. … but mainly these questions ... There are many ways to deploy apps and MongoDB on Kubernetes...
  • 5. There are many ways to deploy apps and MongoDB on Kubernetes Why do I need an Operator? … but mainly these questions ...
  • 6. There are many ways to deploy apps and MongoDB on Kubernetes Why do I need an Operator? Why should I use the MongoDB Enterprise Operator? … but mainly these questions ...
  • 7. As an Operations / DevOps engineer The Operator will make your life easier Fewer manual tasks, more automated failure recovery Skip straight to the answers!
  • 8. As an Operations / DevOps engineer The Operator will make your life easier Fewer manual tasks, more automated failure recovery As a Developer Your company can provide MongoDB as a Service Easy access to production-ready MongoDB with a single click or command Skip straight to the answers!
  • 10. Definition Kubernetes is an open-source container-orchestration system for automating deployment, scaling and management of containerized applications. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation
  • 11. Definition Kubernetes is an open-source container-orchestration system for automating deployment, scaling and management of containerized applications. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation
  • 12. Containers Isolated environments in which you can run your software • Apps ship with their dependencies and configuration bundled in a container Image • Less overhead than Virtual Machines • eg. Docker / rkt for Kubernetes • but many alternatives
  • 13. Definition Kubernetes is an open-source container-orchestration system for automating deployment, scaling and management of containerized applications. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation
  • 14. Orchestration: Kubernetes primitives • Pod - the smallest deployable unit of computing in Kubernetes. Contains 1 or more containers. A pod models an application-specific “logical host” • (Kubernetes) ReplicaSet - guarantees a certain number of pods are running with a given configuration • Deployment - abstraction layer over ReplicaSets nginx-0 nginx-1 nginx-2
  • 15. Orchestration: Features • Replacement - pods which die get rescheduled on a new node. It’s fast! • Consistent, Predictable Hostnames - if your pod gets rescheduled, Kube dns will be updated, so your app can reconnect (Statefulset) • Affinity Rules - configure how close together your instances are. • Same host? Same rack? Same Availability Zone? nginx-0 nginx-1 nginx-2
  • 16. Config Example I need to deploy a stateless app (nginx)
  • 17. Nginx Example apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.7.9 ports: - containerPort: 80
  • 18. Nginx Example host$ kubectl apply -f ngnix.yaml deployment "nginx-deployment" created
  • 19. Results host$ kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx-deployment 2 2 2 2 53s
  • 20. Results host$ kubectl get pods NAME READY STATUS RESTARTS AGE nginx-deployment-75675f5897-cbn5t 1/1 Running 0 5m nginx-deployment-75675f5897-tv8pf 1/1 Running 0 5m
  • 21. Scaling host$ kubectl scale deployment nginx-deployment --replicas=3 deployment "nginx-deployment" scaled
  • 22. Scaling host$ kubectl get pods NAME READY STATUS RESTARTS AGE nginx-deployment-75675f5897-cbn5t 1/1 Running 0 7m nginx-deployment-75675f5897-tv8pf 1/1 Running 0 7m nginx-deployment-75675f5897-ftf9q 0/1 ContainerCreating 0 26s
  • 24. Ops Manager - Monitoring, Automation and Backup MongoDB Ops Manager makes it fast and easy for you to deploy, monitor, upgrade, back up and scale your MongoDB deployment
  • 25. Ops Manager - Monitoring
  • 26. Ops Manager - Automation
  • 27. ● Point-In-Time Recovery ● Continuous, Incremental Backups ● Queryable backups Ops Manager - Backup
  • 30. Operators • Deploying and scaling stateless apps like nginx is easy
  • 31. Operators • Deploying and scaling stateless apps like nginx is easy • Deploying stateful applications - like databases - is more complicated. We’ll need more Kubernetes objects to be created and managed together, and there’s more to do to update versions, scale or organise backups
  • 32. Operators • Deploying and scaling stateless apps like nginx is easy • Deploying stateful applications - like databases - is more complicated. We’ll need more Kubernetes objects to be created and managed together, and there’s more to do to update versions, scale or organise backups • Operators are a way to add application-specific awareness to Kubernetes, so you can automate these complex tasks while taking advantage of Kubernetes Orchestration.
  • 33. Operators • Deploying and scaling stateless apps like nginx is easy • Deploying stateful applications - like databases - is more complicated. We’ll need more Kubernetes objects to be created and managed together, and there’s more to do to update versions, scale or organise backups • Operators are a way to add application-specific awareness to Kubernetes, so you can automate these complex tasks while taking advantage of Kubernetes Orchestration. ⟶ You can teach Kubernetes about MongoDB!
  • 34. Introducing the MongoDB Enterprise Kubernetes Operator
  • 35. MongoDB Enterprise Kubernetes Operator An application that allows you to create and manage MongoDB deployments in Kubernetes cluster with the help of Ops Manager or Cloud Manager • Quick, declarative definition of what MongoDB services you want • Auto-healing, using Kubernetes reliability features • Easy to scale up / scale down
  • 41. Use Case Deploying a Sharded Cluster
  • 43. Ways to deploy a Sharded Cluster
  • 44. Ways to deploy a Sharded Cluster Atlas!
  • 45. Ways to deploy a Sharded Cluster Manually?
  • 46. Ways to deploy a Sharded Cluster? Manually! https://docs.mongodb.com/manual/tutorial/deploy-shard-cluster/ ➔ Time-consuming ➔ Manual management is risky and unreliable ➔ Not reproducible - would need to write your own automation code ◆ Puppet / Chef / Ansible
  • 47. Using Ops Manager Ways to deploy a Sharded Cluster?
  • 48. Using Ops Manager ● Automation! … but ○ Have to configure hardware each time, and install and configure Automation Agents (chef / puppet) ○ Need to trigger failure-recovery in Ops Manager ○ Repeatability - must use APIs Ways to deploy a Sharded Cluster?
  • 49. What if there was a way that … • Could provision hardware from a pool whenever needed • Could recover from failure by requesting new hardware resources • Could easily scale your clusters horizontally or vertically Ways to deploy a Sharded Cluster?
  • 50. What if there was a way that … • Could provision hardware from a pool whenever needed • Could recover from failure by requesting new hardware resources • Could easily scale your clusters horizontally or vertically • Declaratively defined deployment config • Easy to deploy similar configurations / topologies Ways to deploy a Sharded Cluster?
  • 51. Demo Deploying a Sharded Cluster with the MongoDB Enterprise Operator
  • 53. MongoDB version upgrade apiVersion: mongodb.com/v1 kind: MongoDbShardedCluster metadata: name: my-sharded-cluster namespace: mongodb spec: shardCount: 2 mongodsPerShardCount: 3 mongosCount: 2 configServerCount: 3 version: 4.0.0-ent project: demo-project credentials: demo-credentials persistent: false
  • 54. MongoDB version upgrade apiVersion: mongodb.com/v1 kind: MongoDbShardedCluster metadata: name: my-sharded-cluster namespace: mongodb spec: shardCount: 2 mongodsPerShardCount: 3 mongosCount: 2 configServerCount: 3 version: 4.0.0-ent project: demo-project credentials: demo-credentials persistent: false apiVersion: mongodb.com/v1 kind: MongoDbShardedCluster metadata: name: my-sharded-cluster namespace: mongodb spec: shardCount: 2 mongodsPerShardCount: 3 mongosCount: 2 configServerCount: 3 version: 4.0.0-ent project: demo-project credentials: demo-credentials persistent: false
  • 55. Horizontal Scaling apiVersion: mongodb.com/v1 kind: MongoDbShardedCluster metadata: name: my-sharded-cluster namespace: mongodb spec: shardCount: 2 mongodsPerShardCount: 3 mongosCount: 2 configServerCount: 3 version: 4.0.0 project: demo-project credentials: demo-credentials persistent: false
  • 56. Horizontal Scaling apiVersion: mongodb.com/v1 kind: MongoDbShardedCluster metadata: name: my-sharded-cluster namespace: mongodb spec: shardCount: 2 mongodsPerShardCount: 3 mongosCount: 2 configServerCount: 3 version: 4.0.0 project: demo-project credentials: demo-credentials persistent: false apiVersion: mongodb.com/v1 kind: MongoDbShardedCluster metadata: name: my-sharded-cluster namespace: mongodb spec: shardCount: 3 mongodsPerShardCount: 5 mongosCount: 10 configServerCount: 3 version: 4.0.0 project: demo-project credentials: demo-credentials persistent: false
  • 57. Vertical Scaling ... spec: ... mongosPodSpec: cpu: '0.8' memory: 1G shardPodSpec: cpu: '2' memory: 10G configSrvPodSpec: cpu: '1' memory: 7G
  • 58. Vertical Scaling ... spec: ... mongosPodSpec: cpu: '0.8' memory: 1G shardPodSpec: cpu: '2' memory: 10G configSrvPodSpec: cpu: '1' memory: 7G ... spec: ... mongosPodSpec: cpu: '0.8' memory: 1G shardPodSpec: cpu: '4' memory: 20G configSrvPodSpec: cpu: '1' memory: 7G
  • 59. Scaling / Performance: Storage Hardware Control PersistentVolumeClaims ... spec: ... configSrvPodSpec: storage: 5Gi storageClass: standard shardPodSpec: storage: 25Gi storageClass: fast
  • 60. Scaling / Performance: Storage Hardware Control PersistentVolumeClaims ... spec: ... configSrvPodSpec: storage: 5Gi storageClass: standard shardPodSpec: storage: 25Gi storageClass: fast ... spec: ... shardPodSpec: storage: 25Gi storageClass: fast labelSelector: matchExpressions: - {key: diskGroup, operator: In, values: [shardDisks]}
  • 61. Fault Tolerance: Distributing replicas By default Operator ensures that all members of one replica set are distributed to different nodes It’s possible to change this and spread them to different availability zones: configSrvPodSpec: podAntiAffinityTopologyKey: failure-domain.beta.kubernetes.io/zone
  • 62. A common deployment is to co-locate the mongos process on application servers, which allows for local communication between the application and the mongos process. https://www.mongodb.com/collateral/mongodb-performance-best-practices Performance: Co-locate mongos pods with App
  • 63. apiVersion: apps/v1 kind: Deployment metadata: name: web-server spec: selector: matchLabels: app: web-store replicas: 3 template: metadata: labels: app: web-store ... Performance: Co-locate mongos pods with App
  • 64. apiVersion: apps/v1 kind: Deployment metadata: name: web-server spec: selector: matchLabels: app: web-store replicas: 3 template: metadata: labels: app: web-store ... apiVersion: mongodb.com/v1 kind: MongoDbShardedCluster ... spec: ... mongosPodSpec: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app operator: In values: - web-store topologyKey: "kubernetes.io/hostname" Performance: Co-locate mongos pods with App
  • 65. High availability - Replacement • Kubernetes will do its best to match the real state with desired state • If one pod fails, Kubernetes will start another one • The Kubernetes Statefulset primitive will preserve the hostname of the pod, even if scheduled to a different machine • So your MongoDB Driver will be able to connect easily • MongoDB replication will make sure that the new replica catches up • The same PersistentVolume will be mounted, so recovery should be fast
  • 67. As an Operations / DevOps engineer The Operator will make your life easier Fewer manual tasks, more automated failure recovery As a Developer Your company can provide MongoDB as a Service Easy access to production-ready MongoDB with a single click or command So – why use the Operator?
  • 68. Current state • The Operator is in beta now – v.0.4 github.com/mongodb/mongodb-enterprise-kubernetes • We are actively collecting customer and community feedback and building features community-slack.mongodb.com #enterprise- kubernetes • If you have a Kubernetes environment, it’s available for download & pre-production use now.
  • 69. Thanks for listening! Questions? Ask at the Cloud Booth, or in the Community Slack! community-slack.mongodb.com

Editor's Notes

  • #26: Visibility, Alerting, Query Analysis, Index Suggestions
  • #27: Deployments, Upgrades, Ease of Configurability, APIs
  • #29: All the core features of Ops Manager, but without needing to manage the Ops Manager service itself