From 965a52ac2b20d0177719c86dc2a1d18903e9a017 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Sun, 31 Oct 2021 05:14:00 +0330 Subject: updates --- kubernetes/mongodb/mongod.conf | 15 +++++++ kubernetes/mongodb/mongodb-configmap.yaml | 7 +++ kubernetes/mongodb/mongodb-data-volume.yaml | 12 ++++++ kubernetes/mongodb/mongodb-deployment.yaml | 66 +++++++++++++++++++++++++++++ kubernetes/mongodb/mongodb-secret.yaml | 8 ++++ 5 files changed, 108 insertions(+) create mode 100644 kubernetes/mongodb/mongod.conf create mode 100644 kubernetes/mongodb/mongodb-configmap.yaml create mode 100644 kubernetes/mongodb/mongodb-data-volume.yaml create mode 100644 kubernetes/mongodb/mongodb-deployment.yaml create mode 100644 kubernetes/mongodb/mongodb-secret.yaml (limited to 'kubernetes/mongodb') diff --git a/kubernetes/mongodb/mongod.conf b/kubernetes/mongodb/mongod.conf new file mode 100644 index 0000000..85d2bd9 --- /dev/null +++ b/kubernetes/mongodb/mongod.conf @@ -0,0 +1,15 @@ +# vim: ft=yaml +systemLog: + destination: file + path: "/var/log/mongodb/mongod.log" + logAppend: true +storage: + journal: + enabled: true +processManagement: + fork: true +net: + bindIp: 0.0.0.0 + port: 27017 +setParameter: + enableLocalhostAuthBypass: false diff --git a/kubernetes/mongodb/mongodb-configmap.yaml b/kubernetes/mongodb/mongodb-configmap.yaml new file mode 100644 index 0000000..19a484e --- /dev/null +++ b/kubernetes/mongodb/mongodb-configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: mongodb-configmap +data: + mongodb_db__anime_name: anime + mongodb_db_manga_name: manga diff --git a/kubernetes/mongodb/mongodb-data-volume.yaml b/kubernetes/mongodb/mongodb-data-volume.yaml new file mode 100644 index 0000000..6b7d44b --- /dev/null +++ b/kubernetes/mongodb/mongodb-data-volume.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + name: mongo-data +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/kubernetes/mongodb/mongodb-deployment.yaml b/kubernetes/mongodb/mongodb-deployment.yaml new file mode 100644 index 0000000..778fd60 --- /dev/null +++ b/kubernetes/mongodb/mongodb-deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mongodb + labels: + app: mongodb +spec: + replicas: 1 + selector: + matchLabels: + app: mongodb + template: + metadata: + labels: + app: mongodb + spec: + containers: + - name: mongodb + image: mongo:4.4.10 + ports: + - containerPort: 27017 + - containerPort: 27018 + - containerPort: 27019 + env: + - name: MONGO_INITDB_ROOT_USERNAME + valueFrom: + secretKeyRef: + name: mongodb-secrets + key: mongodb-root-username + - name: MONGO_INITDB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mongodb-secrets + key: mongodb-root-password + volumeMounts: + - mountPath: /data/db + name: mongo-data + volumes: + - name: mongo-data + persistentVolumeClaim: + claimName: mongo-data +--- +apiVersion: v1 +kind: Service +metadata: + name: mongodb-service +spec: + selector: + app: mongodb + type: LoadBalancer + ports: + - protocol: TCP + name: "6617" + port: 27117 + targetPort: 27017 + nodePort: 30017 + - protocol: TCP + name: "6618" + port: 27118 + targetPort: 27018 + nodePort: 30018 + - protocol: TCP + name: "6619" + port: 27119 + targetPort: 27019 + nodePort: 30019 diff --git a/kubernetes/mongodb/mongodb-secret.yaml b/kubernetes/mongodb/mongodb-secret.yaml new file mode 100644 index 0000000..3a5fa46 --- /dev/null +++ b/kubernetes/mongodb/mongodb-secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: mongodb-secrets +type: Opaque +data: + mongodb-root-username: bW9uZ29hZG1pbgo= + mongodb-root-password: bW9uZ29hZG1pbgo= -- cgit v1.2.3