From e7d62484cb8107ea51c736861f32115fb53c3948 Mon Sep 17 00:00:00 2001 From: Helder Santana Date: Tue, 5 Mar 2024 10:02:27 -0300 Subject: [PATCH] Update quick start in the CSV --- ...tlas-kubernetes.clusterserviceversion.yaml | 121 +++++++++--------- 1 file changed, 58 insertions(+), 63 deletions(-) diff --git a/config/manifests/bases/mongodb-atlas-kubernetes.clusterserviceversion.yaml b/config/manifests/bases/mongodb-atlas-kubernetes.clusterserviceversion.yaml index 50075e4483..d94dd91163 100644 --- a/config/manifests/bases/mongodb-atlas-kubernetes.clusterserviceversion.yaml +++ b/config/manifests/bases/mongodb-atlas-kubernetes.clusterserviceversion.yaml @@ -60,101 +60,96 @@ spec: name: atlasteams.atlas.mongodb.com version: v1 description: | - The MongoDB Atlas Operator provides a native integration between the Kubernetes orchestration platform and MongoDB Atlas — - the only multi-cloud document database service that gives you the versatility you need to build sophisticated and resilient applications that can adapt to changing customer demands and market trends. - - > Current Status: *Stable*. The Operator gives users the ability to provision - > Atlas projects, clusters and database users using Kubernetes Specifications and bind connection information - > into applications deployed to Kubernetes. + The MongoDB Atlas Operator provides a native integration between the Kubernetes orchestration platform and MongoDB Atlas + — the only multi-cloud document database service that gives you the versatility you need to build sophisticated and + resilient applications that can adapt to changing customer demands and market trends. + + The full documentation for the Operator can be found [here](https://docs.atlas.mongodb.com/atlas-operator/) ## Quick Start guide - ### Step 1. Deploy Kubernetes operator by clicking Install button. + + ### Prerequisites to Install using kubectl + + Before you install the MongoDB Atlas Operator using `kubectl`, you must: + + 1. Install [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/). + 2. Have Kubernetes installed, i.e. [Kind](https://kind.sigs.k8s.io/) + 3. Choose the [version of the operator](https://github.com/mongodb/mongodb-atlas-kubernetes/releases) you want to run + + ### Step 1. Deploy Kubernetes operator using all in one config file - ### Step 2. Create Atlas Cluster + ``` + kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-atlas-kubernetes//deploy/all-in-one.yaml + ``` + ### Step 2. Create Atlas Deployment + **1.** Create an Atlas API Key Secret + In order to work with the Atlas Operator you need to provide [authentication information](https://docs.atlas.mongodb.com/configure-api-access) - to allow the Atlas Operator to communicate with Atlas API. Once you have generated a Public and Private key in Atlas, you can create a Kuberentes Secret with: + to allow the Atlas Operator to communicate with Atlas API. Once you have generated a Public and Private key in Atlas, + you can create a Kuberentes Secret with: + ``` kubectl create secret generic mongodb-atlas-operator-api-key \ - --from-literal="orgId=" \ - --from-literal="publicApiKey=" \ - --from-literal="privateApiKey=" \ - -n openshift-operators + --from-literal='orgId=' \ + --from-literal='publicApiKey=' \ + --from-literal='privateApiKey=' \ + -n mongodb-atlas-system + + kubectl label secret mongodb-atlas-operator-api-key atlas.mongodb.com/type=credentials -n mongodb-atlas-system ``` - (Note, that you should use the namespace where the Operator was installed - it's `openshift-operators` by default) **2.** Create an `AtlasProject` Custom Resource - + The `AtlasProject` CustomResource represents Atlas Projects in our Kubernetes cluster. You need to specify - `projectIpAccessList` with the IP addresses or CIDR blocks of any hosts that will connect to the Atlas Cluster. + `projectIpAccessList` with the IP addresses or CIDR blocks of any hosts that will connect to the Atlas Deployment. + ``` - apiVersion: atlas.mongodb.com/v1 - kind: AtlasProject - metadata: - name: my-project - spec: - name: Test Atlas Operator Project - projectIpAccessList: - - ipAddress: "192.0.2.15" - comment: "IP address for Application Server A" - - cidrBlock: "203.0.113.0/24" - comment: "CIDR block for Application Server B - D" + kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-atlas-kubernetes//config/samples/atlas_v1_atlasproject.yaml ``` + **3.** Create an `AtlasDeployment` Custom Resource. - The example below is a minimal configuration to create an M10 Atlas cluster in the AWS US East region. For a full list of properties, check - `atlasdeployments.atlas.mongodb.com` [CRD specification](config/crd/bases/atlas.mongodb.com_atlasdeployments.yaml)): + + The example below is a configuration to create an M10 Atlas deployment in the AWS US East region. For a full list + of properties, check `atlasdeployments.atlas.mongodb.com` [CRD specification](config/crd/bases/atlas.mongodb.com_atlasdeployments.yaml)): + ``` - apiVersion: atlas.mongodb.com/v1 - kind: AtlasDeployment - metadata: - name: my-atlas-cluster - spec: - name: "Test-cluster" - projectRef: - name: my-project - providerSettings: - instanceSizeName: M10 - providerName: AWS - regionName: US_EAST_1 + kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-atlas-kubernetes//config/samples/atlas_v1_atlasdeployment.yaml ``` **4.** Create a database user password Kubernetes Secret - The Secret must be created in the same namespace as the `AtlasDeployment` and `AtlasProject` were created. + ``` - kubectl create secret generic the-user-password --from-literal="password=P@@sword%" + kubectl create secret generic the-user-password --from-literal='password=P@@sword%' + + kubectl label secret the-user-password atlas.mongodb.com/type=credentials ``` + (note) To create X.509 user please see [this doc](docs/x509-user.md). + **5.** Create an `AtlasDatabaseUser` Custom Resource - In order to connect to an Atlas Cluster the database user needs to be created. `AtlasDatabaseUser` resource should reference - the password Kubernetes Secret created in the previous step. + In order to connect to an Atlas Deployment the database user needs to be created. `AtlasDatabaseUser` resource should + reference the password Kubernetes Secret created in the previous step. + ``` - apiVersion: atlas.mongodb.com/v1 - kind: AtlasDatabaseUser - metadata: - name: my-database-user - spec: - roles: - - roleName: "readWriteAnyDatabase" - databaseName: "admin" - projectRef: - name: my-project - username: theuser - passwordSecretRef: - name: the-user-password + kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-atlas-kubernetes//config/samples/atlas_v1_atlasdatabaseuser.yaml ``` **6.** Wait for the `AtlasDatabaseUser` Custom Resource to be ready - Wait until the AtlasDatabaseUser resource gets to "ready" status (it will wait until the cluster is created that may take around 10 minutes): + Wait until the AtlasDatabaseUser resource gets to "ready" status (it will wait until the deployment is created that may + take around 10 minutes): + ``` kubectl get atlasdatabaseusers my-database-user -o=jsonpath='{.status.conditions[?(@.type=="Ready")].status}' True ``` - ### Step 3. Connect your application to the Atlas Cluster + + ### Step 3. Connect your application to the Atlas Deployment - The Atlas Operator will create a Kubernetes Secret with the information necessary to connect to the Atlas Cluster created - in the previous step. An application in the same Kubernetes Cluster can mount and use the Secret: + The Atlas Operator will create a Kubernetes Secret with the information necessary to connect to the Atlas Deployment + created in the previous step. An application in the same Kubernetes Cluster can mount and use the Secret: ``` ... @@ -164,7 +159,7 @@ spec: - name: "CONNECTION_STRING" valueFrom: secretKeyRef: - name: test-atlas-operator-project-test-cluster-theuser + name: test-atlas-operator-project-test-deployment-theuser key: connectionStringStandardSrv ```