forked from LandmakTechnology/spring-boot-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmongo.yml
73 lines (58 loc) · 1.81 KB
/
mongo.yml
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
apiVersion: apps/v1
# Specifies the API version for this ReplicaSet configuration.
kind: ReplicaSet
# Specifies the kind of resource, which is a ReplicaSet.
metadata:
name: mongodb
# Assigns a name to the ReplicaSet resource.
spec:
# Specifies the specifications for the ReplicaSet.
selector:
matchLabels:
app: mongo
# Selects pods with labels matching "app: mongo".
template:
# Specifies the template for creating pods.
metadata:
name: myapp
# Assigns a name to the pod's metadata.
labels:
app: mongo
# Labels applied to the pod.
spec:
# Specifies the specifications for the pod.
containers:
- name: mongodbcontainer
# Assigns a name to the container.
image: mongo
# Specifies the Docker image to use for the container.
ports:
- containerPort: 27017
# Specifies the port that the container listens on.
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: devdb
# Specifies an environment variable for the container.
- name: MONGO_INITDB_ROOT_PASSWORD
value: devdb@123
# Specifies another environment variable for the container.
---
# A separator to indicate the end of the previous resource configuration.
apiVersion: v1
# Specifies the API version for this Service configuration.
kind: Service
# Specifies the kind of resource, which is a Service.
metadata:
name: mongosvc
# Assigns a name to the Service resource.
spec:
# Specifies the specifications for the Service.
type: ClusterIP
# Specifies the type of Service, which is ClusterIP.
selector:
app: mongo
# Selects pods with the label "app: mongo".
ports:
- port: 27017
targetPort: 27017
# Maps incoming traffic on port 27017 to the pods' target port 27017.