Last active
June 26, 2021 15:17
-
-
Save harivemula/8a619c30782237c941207d5057a56e9e to your computer and use it in GitHub Desktop.
Connecting to MongoDB cluster with Spring Boot Application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring: | |
data: | |
mongodb: | |
uri: mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@mongo-mongodb-0.mongo-mongodb-headless.mongodb.svc:27017,mongo-mongodb-1.mongo-mongodb-headless.mongodb.svc:27017,mongo-mongodb-2.mongo-mongodb-headless.mongodb.svc:27017/test | |
logging: | |
level: | |
org: | |
springframework: | |
data.mongodb: INFO | |
boot.autoconfigure.mongo: INFO | |
com.mongodb.client: INFO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: person | |
name: person | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: person | |
template: | |
metadata: | |
labels: | |
app: person | |
spec: | |
containers: | |
- image: harivemula/person:0.0.1-SNAPSHOT | |
imagePullPolicy: Always | |
name: person | |
volumeMounts: | |
- name: config-volume | |
mountPath: /workspace/config | |
env: | |
- name: MONGODB_USERNAME | |
valueFrom: | |
secretKeyRef: | |
name: mongo-creds | |
key: mongodb-username | |
- name: MONGODB_PASSWORD | |
valueFrom: | |
secretKeyRef: | |
name: mongo-creds | |
key: mongodb-password | |
volumes: | |
- name: config-volume | |
configMap: | |
name: person-config | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
labels: | |
app: person | |
name: person-service | |
namespace: mongodb | |
spec: | |
ports: | |
- port: 80 | |
protocol: TCP | |
targetPort: 8080 | |
selector: | |
app: person | |
type: ClusterIP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
architecture: "replicaset" | |
auth: | |
rootPassword: "rootSecret" | |
username: "testuser" | |
password: "secret" | |
database: "test" | |
replicaSetKey: "testrskey001" | |
replicaSetName: "testrs" | |
replicaCount: 3 | |
persistence: | |
storageClass: "standard" | |
size: 3Gi | |
rbac: | |
create: true | |
podSecurityPolicy: | |
create: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment