This is a Kubernetes Operator which deploys MongoDB Community into Kubernetes clusters.
This codebase is currently pre-alpha, and is not ready for use.
If you are a MongoDB Enterprise customer, or need Enterprise features such as Backup, you can use the MongoDB Enterprise Operator for Kubernetes.
Installation
Prerequisites
Before you install the MongoDB Community Kubernetes Operator, you must:
- Install kubectl.
- Have a Kubernetes solution available to use.
If you need a Kubernetes solution, see the Kubernetes documentation on picking the right solution. For testing, MongoDB recommends Kind.
- Clone this repository.
git clone https://github.com/mongodb/mongodb-kubernetes-operator.git
The MongoDB Community Kubernetes Operator is a Custom Resource Definition and a controller.
To install the MongoDB Community Kubernetes Operator:
- Change to the directory in which you cloned the repository.
- Install the Custom Resource Definitions.
a. Invoke the following
kubectl
command:
kubectl create -f deploy/crds/mongodb.com_mongodb_crd.yaml
b. Verify that the Custom Resource Definitions installed successfully:
kubectl get crd/mongodb.mongodb.com
- Install the Operator.
a. Invoke the following
kubectl
command to install the Operator in the specified namespace:
kubectl create -f deploy --namespace <my-namespace>
b. Verify that the Operator installed successsfully:
kubectl get pods --namespace <my-namespace>
Usage
The /deploy/crds
directory contains example MongoDB resources that you can modify and deploy.
Deploying a MongoDB Resource
To deploy your first replica set:
- Invoke the following
kubectl
command:
kubectl apply -f deploy/crds/mongodb.com_v1_mongodb_cr.yaml --namespace <my-namespace>
- Verify that the MongoDB resource deployed:
kubectl get mongodb --namespace <my-namespace>
Contributing
Please file issues before filing PRs. For PRs to be accepted, contributors must sign our CLA.
Reviewers, please ensure that the CLA has been signed by referring to the contributors tool (internal link).
License
The source code of this Operator is available under the Apache v2 license.
The MongoDB Agent binary in the agent/ directory may be used under the "Free for Commercial Use" license found in agent/LICENSE.