Navigation

MongoDB Enterprise Kubernetes Operator Troubleshooting

Review the Logs

Review Logs from All Pods

If you have an issue with your Kubernetes resources, you can invoke the following command to see logs from all pods in the deployment:

kubectl logs deployments/<deploymentName> -n <metadata.namespace>

See also

Kubernetes documentation on kubectl logs.

Review Logs from Specific Pod

If you want to narrow your review to a specific pod, you can invoke this command:

kubectl logs <podName> -n <metadata.namespace>

Example

If your replica set is labeled myrs, the pod log command is invoked as:

kubectl logs myrs-0 -n <metadata.namespace>

This returns the Automation Agent Log for this replica set.

Find a Specific Pod

To find which pods are available, invoke this command first:

kubectl get pods -n <metadata.namespace>

See also

Kubernetes documentation on kubectl get.

Review Logs from the Kubernetes Operator

To review the Kubernetes Operator logs, invoke this command:

kubectl logs -f deployment/mongodb-enterprise-operator -n <metadata.namespace>

You could check the Ops Manager Logs as well to see if any issues were reported to Ops Manager.

View MongoDB Kubernetes resource Specifications

View All Replica Set MongoDB Kubernetes resource Specifications

To view all replica set MongoDB Kubernetes resource specifications in the provided namespace:

kubectl get mrs -n <namespace>

View All Sharded Cluster MongoDB Kubernetes resource Specifications

To view all sharded cluster MongoDB Kubernetes resource specifications in the provided namespace:

kubectl get msc -n <namespace>

View All Standalone MongoDB Kubernetes resource Specifications

To view all standalone MongoDB Kubernetes resource specifications in the provided namespace:

kubectl get mst -n <namespace>

Example

To read details about the dublin standalone resource, invoke this command:

kubectl get mst dublin -n <namespace> -o yaml

This returns the following response:

apiVersion: mongodb.com/v1
kind: MongoDbStandalone
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"mongodb.com/v1","kind":"MongoDbStandalone","metadata":{"annotations":{},"name":"dublin","namespace":"mongodb"},"spec":{"credentials":"alis-credentials","persistent":false,"podSpec":{"memory":"1G"},"project":"my-om-config","version":"4.0.0-ent"}}
  clusterName: ""
  creationTimestamp: 2018-09-12T17:15:32Z
  generation: 1
  name: dublin
  namespace: mongodb
  resourceVersion: "337269"
  selfLink: /apis/mongodb.com/v1/namespaces/mongodb/mongodbstandalones/dublin
  uid: 7442095b-b6af-11e8-87df-0800271b001d
spec:
  credentials: my-credentials
  persistent: false
  podSpec:
    memory: 1G
  project: my-om-config
  version: 4.0.0-ent

Remove a MongoDB Kubernetes resource

To remove any instance that Kubernetes deployed, you must use Kubernetes.

Important

You can only use the Kubernetes Operator to remove Kubernetes-deployed instances. If you use Ops Manager to remove the instance, Ops Manager throws an error.

Example

To remove a standalone MongoDB instance you created using Kubernetes:

kubectl delete mst -n <metadata.namespace>