Deploying MongoDB in kubernetes does not create pods/services

11/21/2018

I'm following this https://github.com/mongodb/mongodb-enterprise-kubernetes and https://docs.opsmanager.mongodb.com/current/tutorial/install-k8s-operator/ to deploy mongodb inside a Kubernetes cluster on DigitalOcean.

So far everything worked except the last step. Deploying mongodb. I'm trying to do like suggested in the documentation:

---
apiVersion: mongodb.com/v1
kind: MongoDbReplicaSet
metadata:
  name: mongodb-rs
  namespace: mongodb
spec:
  members: 3
  version: 4.0.4

  persistent: true

  project: project-0
  credentials: mongodb-do-ops

It doesn't work. The resource of type MongoDbReplicaSet is created, but no pods and services are deployed like written in docs.

kubectl --kubeconfig="iniside-k8s-test-kubeconfig.yaml" describe MongoDbReplicaSet mongodb-rs -n mongodb

Name:         mongodb-rs
Namespace:    mongodb
Labels:       <none>
Annotations:  <none>
API Version:  mongodb.com/v1
Kind:         MongoDbReplicaSet
Metadata:
  Creation Timestamp:  2018-11-21T21:35:30Z
  Generation:          1
  Resource Version:    2948350
  Self Link:           /apis/mongodb.com/v1/namespaces/mongodb/mongodbreplicasets/mongodb-rs
  UID:                 5e83c7b0-edd5-11e8-88f5-be6ffc4e4dde
Spec:
  Credentials:  mongodb-do-ops
  Members:      3
  Persistent:   true
  Project:      project-0
  Version:      4.0.4
Events:         <none>
-- Łukasz Baran
kubernetes
mongodb

1 Answer

11/22/2018

I got it working. As It stands in documentation here: https://docs.opsmanager.mongodb.com/current/tutorial/install-k8s-operator/

data.projectName

Is not optional. After looking at operator logs, operator cloudn't create replica set deployment because projectName was missing in ConfigMap.

-- Łukasz Baran
Source: StackOverflow