-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSpringBootMongo.yaml
90 lines (90 loc) · 1.83 KB
/
SpringBootMongo.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
apiVersion: apps/v1
kind: Deployment
metadata:
name: springboot-deployment
namespace: production
spec:
replicas: 2
selector:
matchLabels:
application: springbootmongo
strategy:
type: RollingUpdate
template:
metadata:
name: spring-pod
labels:
application: springbootmongo
spec:
containers:
- name: spring-container
image: mithuntechnologies/springboot-mongo-application:1
ports:
- containerPort: 8080
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 400m
memory: 512Mi
env:
- name: MONGO_DB_HOSTNAME
value: mongo-service #MongoDB Service Name
- name: MONGO_DB_USERNAME
value: production
- name: MONGO_DB_PASSWORD
value: production@123
---
apiVersion: v1
kind: Service
metadata:
name: springboot-service
namespace: production
spec:
type: NodePort
selector:
application: springbootmongo
ports:
- port: 80
targetPort: 8080
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: mongo-replicaset
namespace: production
spec:
replicas: 1
selector:
matchLabels:
application: mongo
template:
metadata:
name: mongo-pod
labels:
application: mongo
spec:
containers:
- name: mongo-container
image: mongo
ports:
- containerPort: 27017
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: production
- name: MONGO_INITDB_ROOT_PASSWORD
value: production@123
---
apiVersion: v1
kind: Service
metadata:
name: mongo-service #Service Name Should be Given for MONGO_DB_HOSTNAME
namespace: production
spec:
type: ClusterIP
selector:
application: mongo
ports:
- port: 27017
targetPort: 27017