From 14da00b30d18b2728d16fc12d6a2a374d9cc27be Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Tue, 2 Nov 2021 05:41:15 +0330 Subject: updates --- kubernetes/mongodb/deploy.sh | 11 ++++++++ kubernetes/mongodb/mongod.conf | 24 +++++++++-------- kubernetes/mongodb/mongodb-configmap.yaml | 2 +- kubernetes/mongodb/mongodb-deployment.yaml | 42 ++++++++++++++++++++++++++++-- 4 files changed, 65 insertions(+), 14 deletions(-) create mode 100755 kubernetes/mongodb/deploy.sh (limited to 'kubernetes') diff --git a/kubernetes/mongodb/deploy.sh b/kubernetes/mongodb/deploy.sh new file mode 100755 index 0000000..db60298 --- /dev/null +++ b/kubernetes/mongodb/deploy.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +kubectl apply -f ./mongodb-secret.yaml +kubectl apply -f ./mongodb-configmap.yaml +kubectl apply -f ./mongodb-data-volume.yaml +kubectl create configmap mongodb-config-file --from-file=mongod.conf +kubectl apply -f ./mongodb-deployment.yaml + +# kubectl delete pod mongodb +# kubectl delete pvc +# kubectl delete pv diff --git a/kubernetes/mongodb/mongod.conf b/kubernetes/mongodb/mongod.conf index 85d2bd9..b431e24 100644 --- a/kubernetes/mongodb/mongod.conf +++ b/kubernetes/mongodb/mongod.conf @@ -1,15 +1,17 @@ # vim: ft=yaml -systemLog: - destination: file - path: "/var/log/mongodb/mongod.log" - logAppend: true -storage: - journal: - enabled: true -processManagement: - fork: true +# systemLog: +# destination: file +# path: "/var/log/mongodb/mongod.log" +# logAppend: true +# storage: +# journal: +# enabled: true +# processManagement: +# fork: true +# setParameter: +# enableLocalhostAuthBypass: false net: bindIp: 0.0.0.0 port: 27017 -setParameter: - enableLocalhostAuthBypass: false +security: + authorization: "enabled" diff --git a/kubernetes/mongodb/mongodb-configmap.yaml b/kubernetes/mongodb/mongodb-configmap.yaml index 19a484e..0f3d693 100644 --- a/kubernetes/mongodb/mongodb-configmap.yaml +++ b/kubernetes/mongodb/mongodb-configmap.yaml @@ -3,5 +3,5 @@ kind: ConfigMap metadata: name: mongodb-configmap data: - mongodb_db__anime_name: anime + mongodb_db_anime_name: anime mongodb_db_manga_name: manga diff --git a/kubernetes/mongodb/mongodb-deployment.yaml b/kubernetes/mongodb/mongodb-deployment.yaml index 778fd60..2002146 100644 --- a/kubernetes/mongodb/mongodb-deployment.yaml +++ b/kubernetes/mongodb/mongodb-deployment.yaml @@ -17,6 +17,38 @@ spec: containers: - name: mongodb image: mongo:4.4.10 + livenessProbe: + exec: + command: + - mongo + - --disableImplicitSessions + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 6 + readinessProbe: + exec: + command: + - mongo + - --disableImplicitSessions + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 6 + command: + - mongod + - --config + - /etc/mongod.conf/mongod.conf + - --noauth + - --dbpath + - /data/db + - --bind_ip_all ports: - containerPort: 27017 - containerPort: 27018 @@ -33,12 +65,18 @@ spec: name: mongodb-secrets key: mongodb-root-password volumeMounts: - - mountPath: /data/db - name: mongo-data + - name: mongo-data + mountPath: /data/db + - name: mongo-conf + mountPath: /etc/mongod.conf + readOnly: true volumes: - name: mongo-data persistentVolumeClaim: claimName: mongo-data + - name: mongo-conf + configMap: + name: mongodb-config-file --- apiVersion: v1 kind: Service -- cgit v1.2.3