diff --git a/docs/server/source/production-deployment-template/node-on-kubernetes.rst b/docs/server/source/production-deployment-template/node-on-kubernetes.rst index 2ee3dc49..9b331402 100644 --- a/docs/server/source/production-deployment-template/node-on-kubernetes.rst +++ b/docs/server/source/production-deployment-template/node-on-kubernetes.rst @@ -233,6 +233,11 @@ Step 6: Start the MongoDB Kubernetes Service the ConfigMap followed by ``-ss``. For example, if the value set in the ``mdb-instance-name`` is ``mdb-instance-0``, set the ``spec.selector.app`` to ``mdb-instance-0-ss``. + + * Set ``ports[0].port`` and ``ports[0].targetPort`` to the value set in the + ``mongodb-backend-port`` in the ConfigMap above. + This is the ``mdb-port`` in the file which specifies where MongoDB listens + for API requests. * Start the Kubernetes Service: @@ -491,6 +496,11 @@ Step 12: Start a Kubernetes StatefulSet for MongoDB * As we gain more experience running MongoDB in testing and production, we will tweak the ``resources.limits.cpu`` and ``resources.limits.memory``. + * Set the ports to be exposed from the pod in the + ``spec.containers[0].ports`` section. We currently only expose the MongoDB + backend port. Set it to the value specified for ``mongodb-backend-port`` + in the ConfigMap. + * Create the MongoDB StatefulSet using: .. code:: bash diff --git a/k8s/bigchaindb/bigchaindb-svc.yaml b/k8s/bigchaindb/bigchaindb-svc.yaml index f439d80f..a745e8d9 100644 --- a/k8s/bigchaindb/bigchaindb-svc.yaml +++ b/k8s/bigchaindb/bigchaindb-svc.yaml @@ -12,8 +12,10 @@ spec: - port: "" targetPort: "" name: bdb-api-port + protocol: TCP - port: "" targetPort: "" name: bdb-ws-port + protocol: TCP type: ClusterIP clusterIP: None diff --git a/k8s/mongodb/mongo-ss.yaml b/k8s/mongodb/mongo-ss.yaml index 6db99142..e7edf8aa 100644 --- a/k8s/mongodb/mongo-ss.yaml +++ b/k8s/mongodb/mongo-ss.yaml @@ -39,7 +39,10 @@ spec: name: vars key: mongodb-replicaset-name - name: MONGODB_PORT - value: "27017" + valueFrom: + configMapKeyRef: + name: vars + key: mongodb-backend-port args: - --mongodb-port - $(MONGODB_PORT) @@ -60,10 +63,9 @@ spec: add: - FOWNER ports: - - containerPort: 27017 - hostPort: 27017 - name: mdb-port + - containerPort: "" protocol: TCP + name: mdb-api-port volumeMounts: - name: mdb-db mountPath: /data/db @@ -78,11 +80,12 @@ spec: memory: 3.5G livenessProbe: tcpSocket: - port: mdb-port + port: mdb-api-port + initialDelaySeconds: 15 successThreshold: 1 failureThreshold: 3 periodSeconds: 15 - timeoutSeconds: 1 + timeoutSeconds: 10 restartPolicy: Always volumes: - name: mdb-db diff --git a/k8s/mongodb/mongo-svc.yaml b/k8s/mongodb/mongo-svc.yaml index 2c81797a..df3e7c87 100644 --- a/k8s/mongodb/mongo-svc.yaml +++ b/k8s/mongodb/mongo-svc.yaml @@ -9,8 +9,9 @@ spec: selector: app: mdb-instance-0-ss ports: - - port: 27017 - targetPort: 27017 + - port: "" + targetPort: "" name: mdb-port + protocol: TCP type: ClusterIP clusterIP: None