Navigation

Atlas Kubernetes Operator

You can use Atlas Kubernetes Operator to manage resources in Atlas without leaving Kubernetes. The application is deployed into Kubernetes clusters. Atlas Kubernetes Operator manages resources in Atlas based on Kubernetes custom resources. It helps to ensure that the state of the projects, clusters, and database users in Atlas matches the configurations in the AtlasProject, AtlasCluster, and AtlasDatabaseUser custom resources that you create in your Kubernetes cluster.

Atlas Kubernetes Operator supports the following custom resources:

Resource
Description
Configuration of a project in Atlas.
Configuration of a cluster inside some project in Atlas.
Configuration of a database user inside some project in Atlas.

Each time you change the spec field in any of the supported managed custom resources, the following workflow begins in Atlas Kubernetes Operator:

  1. Atlas Kubernetes Operator receives an event about the changed custom resource.
  2. Atlas Kubernetes Operator updates the status.conditions field to reflect that the resource is not ready:

    conditions:
    - lastTransitionTime: "2021-03-13T16:26:17Z"
    status: "False"
    type: Ready
  3. To connect to the Atlas API, Atlas Kubernetes Operator reads the organization ID and API keys from one of the following locations:

  4. To create or update resources in Atlas, Atlas Kubernetes Operator uses the connection information to make API calls to Atlas.

    Note

    Sometimes Atlas Kubernetes Operator makes multiple API calls in Atlas during the reconciliation of a custom resource. For example, AtlasProject has an IP Access List configuration for calling the matching API.

  5. If any errors occur during the reconciliation, status.conditions updates to reflect the error.

    Example
    - lastTransitionTime: "2021-03-15T14:26:44Z"
    message: 'POST https://cloud.mongodb.com/api/atlas/v1.0/groups/604a47de73cd8cag77239021/accessList:
    400 (request "INVALID_IP_ADDRESS_OR_CIDR_NOTATION") The address 192.0.2.1dfdfd5
    must be in valid IP address or CIDR notation.'
    reason: ProjectIPAccessListNotCreatedInAtlas
    status: "False"
    type: IPAccessListReady
  6. If the update succeeds, status.conditions reflects that the resource is ready:

    conditions:
    - lastTransitionTime: "2021-03-13T16:26:17Z"
    status: "True"
    type: Ready

If you remove a custom resource from Kubernetes, Atlas Kubernetes Operator tries to clean the state in Atlas, and the following workflow begins:

  1. Atlas Kubernetes Operator receives an event about the deleted custom resource.
  2. To connect to the Atlas API, Atlas Kubernetes Operator reads the organization ID and API keys from one of the following locations:

  3. To delete the resource from Atlas, Atlas Kubernetes Operator uses the connection information to make API calls to Atlas.

    Note

    Atlas Kubernetes Operator removes any related objects created in Kubernetes. For example, if you remove AtlasDatabaseUser, Atlas Kubernetes Operator removes the related connection secrets.

Give Feedback

On this page

  • Atlas Kubernetes Operator Workflow
  • Create and Update Process
  • Delete Process