Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDP-222191: Update quick start guide and provided samples #1421

Merged
merged 5 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 14 additions & 136 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,147 +9,25 @@ resilient applications that can adapt to changing customer demands and market tr

The full documentation for the Operator can be found [here](https://docs.atlas.mongodb.com/atlas-operator/)

## Quick Start guide
## Getting Started

### Step 1. Deploy Kubernetes operator using all in one config file
### Supported features

```
kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-atlas-kubernetes/main/deploy/all-in-one.yaml
```
* Create and configure a project, or connect to an existing one.
helderjs marked this conversation as resolved.
Show resolved Hide resolved
* Deploy, manage, scale, and tear down clusters.
helderjs marked this conversation as resolved.
Show resolved Hide resolved
* Support for serverless instances.
helderjs marked this conversation as resolved.
Show resolved Hide resolved
* Create and edit database users.
* Manage IP Access Lists, network peering and private endpoints.
* Configure and control Atlas’s fully managed cloud backup.
* Configure federated authentication for your Atlas organization
* Integrate Atlas monitoring with Prometheus.

### Step 2. Create Atlas Deployment
... and more.

**1.** Create an Atlas API Key Secret
To view the list of custom resources and each CR's schema, visit our [reference](https://www.mongodb.com/docs/atlas/operator/stable/custom-resources/)
helderjs marked this conversation as resolved.
Show resolved Hide resolved
documentation. See the [Quickstart](https://www.mongodb.com/docs/atlas/operator/stable/ak8so-quick-start/) to get started
with Atlas Kubernetes Operator.

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:

```
kubectl create secret generic mongodb-atlas-operator-api-key \
--from-literal='orgId=<the_atlas_organization_id>' \
--from-literal='publicApiKey=<the_atlas_api_public_key>' \
--from-literal='privateApiKey=<the_atlas_api_private_key>' \
-n mongodb-atlas-system

kubectl label secret mongodb-atlas-operator-api-key atlas.mongodb.com/type=credentials -n mongodb-atlas-system
```

**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 Deployment.

```
cat <<EOF | kubectl apply -f -
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"
EOF
```

**3.** Create an `AtlasDeployment` Custom Resource.

The example below is a minimal 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)):

```
cat <<EOF | kubectl apply -f -
apiVersion: atlas.mongodb.com/v1
kind: AtlasDeployment
metadata:
name: my-atlas-deployment
spec:
projectRef:
name: my-project
deploymentSpec:
name: test-deployment
providerSettings:
instanceSizeName: M10
providerName: AWS
regionName: US_EAST_1
EOF
```

**4.** Create a database user password Kubernetes Secret

```
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 Deployment the database user needs to be created. `AtlasDatabaseUser` resource should
reference the password Kubernetes Secret created in the previous step.

```
cat <<EOF | kubectl apply -f -
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
EOF
```

**6.** Wait for the `AtlasDatabaseUser` Custom Resource to be ready

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 Deployment

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:

```
...
containers:
- name: test-app
env:
- name: "CONNECTION_STRING"
valueFrom:
secretKeyRef:
name: test-atlas-operator-project-test-cluster-theuser
key: connectionStringStandardSrv

```

## Additional information or features

In certain cases you can modify the default operator behaviour via [annotations](docs/annotations.md).

Operator support Third Party Integration.

- [Mongodb Atlas Operator sample](docs/project-integration.md)
- [Atlas documentation Atlas](https://docs.atlas.mongodb.com/reference/api/third-party-integration-settings/)

## How to Contribute

Expand Down
Loading
Loading