added conf files for k8s
This commit is contained in:
61
cluster2/deployment-mongo2.yaml
Normal file
61
cluster2/deployment-mongo2.yaml
Normal file
@@ -0,0 +1,61 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mongo2
|
||||
namespace: cluster2
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mongo2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mongo2
|
||||
spec:
|
||||
containers:
|
||||
- name: mongo
|
||||
image: mongo:7
|
||||
ports:
|
||||
- containerPort: 27017
|
||||
env:
|
||||
- name: MONGO_INITDB_ROOT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cluster2-mongo-secret
|
||||
key: MONGO_INITDB_ROOT_USERNAME
|
||||
- name: MONGO_INITDB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cluster2-mongo-secret
|
||||
key: MONGO_INITDB_ROOT_PASSWORD
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data/db
|
||||
- name: init-scripts
|
||||
mountPath: /docker-entrypoint-initdb.d/init.js
|
||||
subPath: mongo2-init.js
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: mongo2-data
|
||||
- name: init-scripts
|
||||
configMap:
|
||||
name: cluster2-init-scripts
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mongo2
|
||||
namespace: cluster2
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: mongo2
|
||||
ports:
|
||||
- name: mongo
|
||||
port: 27017
|
||||
targetPort: 27017
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user