<p>I am currently trying to deploy the following on Minikube. 
I updated the configuration files to use a hostpath as a persistent storage on minikube node.</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: "pv-volume"
spec:
  capacity:
    storage: "20Gi"
  accessModes:
    - "ReadWriteOnce"
  hostPath:
    path: /data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: "orientdb-pv-claim"
spec:
  accessModes:
    - "ReadWriteOnce"
  resources:
    requests:
      storage: "20Gi"
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: orientdbservice 
spec:
  #replicas: 1
  template:
    metadata:
     name: orientdbservice
     labels:
       run: orientdbservice
       test: orientdbservice
    spec:
      containers:
        - name: orientdbservice
          image: orientdb:latest
          env:
           - name: ORIENTDB_ROOT_PASSWORD
             value: "rootpwd"
          ports:
          - containerPort: 2480
            name: orientdb
          volumeMounts:
          - name: orientdb-config
            mountPath: /data/orientdb/config
          - name: orientdb-databases
            mountPath: /data/orientdb/databases 
          - name: orientdb-backup
            mountPath: /data/orientdb/backup
      volumes:
          - name: orientdb-config
            persistentVolumeClaim:
              claimName: orientdb-pv-claim
          - name: orientdb-databases
            persistentVolumeClaim:
              claimName: orientdb-pv-claim
          - name: orientdb-backup
            persistentVolumeClaim:
              claimName: orientdb-pv-claim
---
apiVersion: v1
kind: Service
metadata:
  name: orientdbservice
  labels:
    run: orientdbservice
spec:
  type: NodePort
  selector:
    run: orientdbservice
  ports:
   - protocol: TCP
     port: 2480
     name: http
</code></pre>

<p>which results in the following:</p>

<pre><code>#kubectl get pv
NAME                                       CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS      CLAIM                       STORAGECLASS   REASON    AGE
pv-volume                                  20Gi       RWO           Retain          Available                                                        4h
pvc-cd14d593-78fc-11e7-a46d-1277ec3dd2b5   20Gi       RWO           Delete          Bound       default/orientdb-pv-claim   standard                 4h
#kubectl get pvc
NAME                STATUS    VOLUME                                     CAPACITY   ACCESSMODES   STORAGECLASS   AGE
orientdb-pv-claim   Bound     pvc-cd14d593-78fc-11e7-a46d-1277ec3dd2b5   20Gi       RWO           standard       4h
#kubectl get svc
NAME                              READY     STATUS              RESTARTS   AGE
orientdbservice-458328598-zsmw5   0/1       ContainerCreating   0          3h
#kubectl describe pod orientdbservice-458328598-zsmw5 
.
.
.
Events:
  FirstSeen LastSeen    Count   From            SubObjectPath   TypeReason      Message
  --------- --------    -----   ----            -------------   --------    ------      -------
  3h        41s     26  kubelet, minikube           Warning     FailedMount Unable to mount volumes for pod "orientdbservice-458328598-zsmw5_default(392b1298-78ff-11e7-a46d-1277ec3dd2b5)": timeout expired waiting for volumes to attach/mount for pod "default"/"orientdbservice-458328598-zsmw5". list of unattached/unmounted volumes=[orientdb-databases]
</code></pre>

<p>It seems that volumes are not able mount for the pod. Is there something wrong with the way I am creating a persistent volume on my node ?
Appreciate all the help</p>

<p>Few questions before I tell you what worked for me:</p>

<ul>
<li>The directory <code>/data</code> on minikube machine does it have right set of permissions?</li>
<li>In minikube you don't need to worry about setting up volumes in other words don't worry about <code>PersistentVolume</code> anymore, just enable the volume provisioner addon using following command. Once you do that every <code>PersistentVolumeClaim</code> that tries to claim storage will get whatever it needs.</li>
</ul>

<p><code>minikube addons enable default-storageclass</code></p>

<p>So here is what worked for me:</p>

<ul>
<li>I removed the <code>PersistentVolume</code></li>
<li>I have changed the <code>mountPath</code> also to match what is given in the upstream docs <a href="https://hub.docker.com/_/orientdb/" rel="nofollow noreferrer">https://hub.docker.com/_/orientdb/</a></li>
<li>I have added separate <code>PersistentVolumeClaim</code> for <code>databases</code> and <code>backup</code></li>
<li>I have changed the <code>config</code> from a <code>PersistentVolumeClaim</code> to <code>configMap</code>, so you don't need to care about <em>how do I get the config to running cluster?</em>, you do it using configMap. Because the config is coming from set of config Files.</li>
</ul>

<p>Here is the config that worked for me:</p>

<pre><code>---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    app: orientdbservice
  name: orientdb-databases
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
status: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    app: orientdbservice
  name: orientdb-backup
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
status: {}
---
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    app: orientdbservice
  name: orientdbservice
spec:
  ports:
  - name: orientdbservice-2480
    port: 2480
    targetPort: 0
  - name: orientdbservice-2424
    port: 2424
    targetPort: 0
  selector:
    app: orientdbservice
  type: NodePort
status:
  loadBalancer: {}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: orientdbservice
  name: orientdbservice
spec:
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: orientdbservice
      name: orientdbservice
    spec:
      containers:
      - env:
        - name: ORIENTDB_ROOT_PASSWORD
          value: rootpwd
        image: orientdb
        name: orientdbservice
        resources: {}
        volumeMounts:
        - mountPath: /orientdb/databases
          name: orientdb-databases
        - mountPath: /orientdb/backup
          name: orientdb-backup
        - mountPath: /orientdb/config
          name: orientdb-config
      volumes:
      - configMap:
          name: orientdb-config
        name: orientdb-config
      - name: orientdb-databases
        persistentVolumeClaim:
          claimName: orientdb-databases
      - name: orientdb-backup
        persistentVolumeClaim:
          claimName: orientdb-backup
</code></pre>

<p>And for <code>configMap</code> I had to goto this directory for sample config <a href="https://github.com/orientechnologies/orientdb-docker/tree/b226ca56bc9efb89ebbd79d68a05234af76fd0ae/examples/3-nodes-compose/var/odb3/config" rel="nofollow noreferrer">examples/3-nodes-compose/var/odb3/config</a> in github repository <a href="https://github.com/orientechnologies/orientdb-docker" rel="nofollow noreferrer">orientechnologies/orientdb-docker</a></p>

<p>You goto above directory or directory you have saved config in and run following command:</p>

<pre><code>kubectl create configmap orientdb-config --from-file=.
</code></pre>

<p>If you wanna see what is being created automatically and being deployed run following:</p>

<pre><code>kubectl create configmap orientdb-config --from-file=. --dry-run -o yaml
</code></pre>

<p>Here is the configMap I have used to do my deployment:</p>

<pre><code>apiVersion: v1
data:
  automatic-backup.json: |-
    {
      "enabled": true,
      "mode": "FULL_BACKUP",
      "exportOptions": "",
      "delay": "4h",
      "firstTime": "23:00:00",
      "targetDirectory": "backup",
      "targetFileName": "${DBNAME}-${DATE:yyyyMMddHHmmss}.zip",
      "compressionLevel": 9,
      "bufferSize": 1048576
    }
  backups.json: |-
    {
      "backups": []
    }
  default-distributed-db-config.json: |
    {
      "autoDeploy": true,
      "readQuorum": 1,
      "writeQuorum": "majority",
      "executionMode": "undefined",
      "readYourWrites": true,
      "newNodeStrategy": "static",
      "servers": {
        "*": "master"
      },
      "clusters": {
        "internal": {
        },
        "*": {
          "servers": [
            "&lt;NEW_NODE&gt;"
          ]
        }
      }
    }
  events.json: |-
    {
      "events": []
    }
  hazelcast.xml: "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;!-- ~ Copyright (c)
    2008-2012, Hazel Bilisim Ltd. All Rights Reserved. ~ \n\t~ Licensed under the
    Apache License, Version 2.0 (the \"License\"); ~ you may \n\tnot use this file
    except in compliance with the License. ~ You may obtain \n\ta copy of the License
    at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ \n\t~ Unless required by applicable
    law or agreed to in writing, software ~ distributed \n\tunder the License is distributed
    on an \"AS IS\" BASIS, ~ WITHOUT WARRANTIES \n\tOR CONDITIONS OF ANY KIND, either
    express or implied. ~ See the License for \n\tthe specific language governing
    permissions and ~ limitations under the License. --&gt;\n\n&lt;hazelcast\n\txsi:schemaLocation=\"http://www.hazelcast.com/schema/config
    hazelcast-config-3.3.xsd\"\n\txmlns=\"http://www.hazelcast.com/schema/config\"
    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"&gt;\n\t&lt;group&gt;\n\t\t&lt;name&gt;orientdb&lt;/name&gt;\n\t\t&lt;password&gt;orientdb&lt;/password&gt;\n\t&lt;/group&gt;\n\t&lt;network&gt;\n\t\t&lt;port
    auto-increment=\"true\"&gt;2434&lt;/port&gt;\n\t\t&lt;join&gt;\n\t\t\t&lt;multicast enabled=\"true\"&gt;\n\t\t\t\t&lt;multicast-group&gt;235.1.1.1&lt;/multicast-group&gt;\n\t\t\t\t&lt;multicast-port&gt;2434&lt;/multicast-port&gt;\n\t\t\t&lt;/multicast&gt;\n\t\t&lt;/join&gt;\n\t&lt;/network&gt;\n\t&lt;executor-service&gt;\n\t\t&lt;pool-size&gt;16&lt;/pool-size&gt;\n\t&lt;/executor-service&gt;\n&lt;/hazelcast&gt;\n"
  orientdb-client-log.properties: |
    #
    # /*
    #  *  Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
    #  *
    #  *  Licensed under the Apache License, Version 2.0 (the "License");
    #  *  you may not use this file except in compliance with the License.
    #  *  You may obtain a copy of the License at
    #  *
    #  *       http://www.apache.org/licenses/LICENSE-2.0
    #  *
    #  *  Unless required by applicable law or agreed to in writing, software
    #  *  distributed under the License is distributed on an "AS IS" BASIS,
    #  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    #  *  See the License for the specific language governing permissions and
    #  *  limitations under the License.
    #  *
    #  * For more information: http://www.orientechnologies.com
    #  */
    #

    # Specify the handlers to create in the root logger
    # (all loggers are children of the root logger)
    # The following creates two handlers
    handlers = java.util.logging.ConsoleHandler

    # Set the default logging level for the root logger
    .level = ALL
    com.orientechnologies.orient.server.distributed.level = FINE
    com.orientechnologies.orient.core.level = WARNING

    # Set the default logging level for new ConsoleHandler instances
    java.util.logging.ConsoleHandler.level = WARNING
    # Set the default formatter for new ConsoleHandler instances
    java.util.logging.ConsoleHandler.formatter = com.orientechnologies.common.log.OLogFormatter
  orientdb-server-config.xml: |
    &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
    &lt;orient-server&gt;
        &lt;handlers&gt;
            &lt;handler class="com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin"&gt;
                &lt;parameters&gt;
                    &lt;parameter value="${distributed}" name="enabled"/&gt;
                    &lt;parameter value="${ORIENTDB_HOME}/config/default-distributed-db-config.json" name="configuration.db.default"/&gt;
                    &lt;parameter value="${ORIENTDB_HOME}/config/hazelcast.xml" name="configuration.hazelcast"/&gt;
                    &lt;parameter value="odb3" name="nodeName"/&gt;
                &lt;/parameters&gt;
            &lt;/handler&gt;
            &lt;handler class="com.orientechnologies.orient.server.handler.OJMXPlugin"&gt;
                &lt;parameters&gt;
                    &lt;parameter value="false" name="enabled"/&gt;
                    &lt;parameter value="true" name="profilerManaged"/&gt;
                &lt;/parameters&gt;
            &lt;/handler&gt;
            &lt;handler class="com.orientechnologies.orient.server.handler.OAutomaticBackup"&gt;
                &lt;parameters&gt;
                    &lt;parameter value="false" name="enabled"/&gt;
                    &lt;parameter value="${ORIENTDB_HOME}/config/automatic-backup.json" name="config"/&gt;
                &lt;/parameters&gt;
            &lt;/handler&gt;
            &lt;handler class="com.orientechnologies.orient.server.handler.OServerSideScriptInterpreter"&gt;
                &lt;parameters&gt;
                    &lt;parameter value="true" name="enabled"/&gt;
                    &lt;parameter value="SQL" name="allowedLanguages"/&gt;
                &lt;/parameters&gt;
            &lt;/handler&gt;
            &lt;handler class="com.orientechnologies.orient.server.plugin.livequery.OLiveQueryPlugin"&gt;
                &lt;parameters&gt;
                    &lt;parameter value="false" name="enabled"/&gt;
                &lt;/parameters&gt;
            &lt;/handler&gt;
        &lt;/handlers&gt;
        &lt;network&gt;
            &lt;sockets&gt;
                &lt;socket implementation="com.orientechnologies.orient.server.network.OServerSSLSocketFactory" name="ssl"&gt;
                    &lt;parameters&gt;
                        &lt;parameter value="false" name="network.ssl.clientAuth"/&gt;
                        &lt;parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/&gt;
                        &lt;parameter value="password" name="network.ssl.keyStorePassword"/&gt;
                        &lt;parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/&gt;
                        &lt;parameter value="password" name="network.ssl.trustStorePassword"/&gt;
                    &lt;/parameters&gt;
                &lt;/socket&gt;
                &lt;socket implementation="com.orientechnologies.orient.server.network.OServerSSLSocketFactory" name="https"&gt;
                    &lt;parameters&gt;
                        &lt;parameter value="false" name="network.ssl.clientAuth"/&gt;
                        &lt;parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/&gt;
                        &lt;parameter value="password" name="network.ssl.keyStorePassword"/&gt;
                        &lt;parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/&gt;
                        &lt;parameter value="password" name="network.ssl.trustStorePassword"/&gt;
                    &lt;/parameters&gt;
                &lt;/socket&gt;
            &lt;/sockets&gt;
            &lt;protocols&gt;
                &lt;protocol implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary" name="binary"/&gt;
                &lt;protocol implementation="com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb" name="http"/&gt;
            &lt;/protocols&gt;
            &lt;listeners&gt;
                &lt;listener protocol="binary" socket="default" port-range="2424-2430" ip-address="0.0.0.0"/&gt;
                &lt;listener protocol="http" socket="default" port-range="2480-2490" ip-address="0.0.0.0"&gt;
                    &lt;commands&gt;
                        &lt;command implementation="com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent" pattern="GET|www GET|studio/ GET| GET|*.htm GET|*.html GET|*.xml GET|*.jpeg GET|*.jpg GET|*.png GET|*.gif GET|*.js GET|*.css GET|*.swf GET|*.ico GET|*.txt GET|*.otf GET|*.pjs GET|*.svg GET|*.json GET|*.woff GET|*.woff2 GET|*.ttf GET|*.svgz" stateful="false"&gt;
                            &lt;parameters&gt;
                                &lt;entry value="Cache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache" name="http.cache:*.htm *.html"/&gt;
                                &lt;entry value="Cache-Control: max-age=120" name="http.cache:default"/&gt;
                            &lt;/parameters&gt;
                        &lt;/command&gt;
                    &lt;/commands&gt;
                    &lt;parameters&gt;
                        &lt;parameter value="utf-8" name="network.http.charset"/&gt;
                        &lt;parameter value="true" name="network.http.jsonResponseError"/&gt;
                        &lt;parameter value="Access-Control-Allow-Origin:*;Access-Control-Allow-Credentials: true" name="network.http.additionalResponseHeaders"/&gt;
                    &lt;/parameters&gt;
                &lt;/listener&gt;
            &lt;/listeners&gt;
        &lt;/network&gt;
        &lt;storages/&gt;
        &lt;users&gt;
            &lt;user resources="*" password="{PBKDF2WithHmacSHA256}8B5E4C8ABD6A68E8329BD58D1C785A467FD43809823C8192:BE5D490BB80D021387659F7EF528D14130B344D6D6A2D590:65536" name="root"/&gt;
            &lt;user resources="connect,server.listDatabases,server.dblist" password="{PBKDF2WithHmacSHA256}268A3AFC0D2D9F25AB7ECAC621B5EA48387CF2B9996E1881:CE84E3D0715755AA24545C23CDACCE5EBA35621E68E34BF2:65536" name="guest"/&gt;
        &lt;/users&gt;
        &lt;properties&gt;
            &lt;entry value="1" name="db.pool.min"/&gt;
            &lt;entry value="50" name="db.pool.max"/&gt;
            &lt;entry value="true" name="profiler.enabled"/&gt;
        &lt;/properties&gt;
        &lt;isAfterFirstTime&gt;true&lt;/isAfterFirstTime&gt;
    &lt;/orient-server&gt;
  orientdb-server-log.properties: |
    #
    # /*
    #  *  Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
    #  *
    #  *  Licensed under the Apache License, Version 2.0 (the "License");
    #  *  you may not use this file except in compliance with the License.
    #  *  You may obtain a copy of the License at
    #  *
    #  *       http://www.apache.org/licenses/LICENSE-2.0
    #  *
    #  *  Unless required by applicable law or agreed to in writing, software
    #  *  distributed under the License is distributed on an "AS IS" BASIS,
    #  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    #  *  See the License for the specific language governing permissions and
    #  *  limitations under the License.
    #  *
    #  * For more information: http://www.orientechnologies.com
    #  */
    #

    # Specify the handlers to create in the root logger
    # (all loggers are children of the root logger)
    # The following creates two handlers
    handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler

    # Set the default logging level for the root logger
    .level = INFO
    com.orientechnologies.level = INFO
    com.orientechnologies.orient.server.distributed.level = INFO

    # Set the default logging level for new ConsoleHandler instances
    java.util.logging.ConsoleHandler.level = INFO
    # Set the default formatter for new ConsoleHandler instances
    java.util.logging.ConsoleHandler.formatter = com.orientechnologies.common.log.OAnsiLogFormatter

    # Set the default logging level for new FileHandler instances
    java.util.logging.FileHandler.level = INFO
    # Naming style for the output file
    java.util.logging.FileHandler.pattern=../log/orient-server.log
    # Set the default formatter for new FileHandler instances
    java.util.logging.FileHandler.formatter = com.orientechnologies.common.log.OLogFormatter
    # Limiting size of output file in bytes:
    java.util.logging.FileHandler.limit=10000000
    # Number of output files to cycle through, by appending an
    # integer to the base file name:
    java.util.logging.FileHandler.count=10
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: orientdb-config
</code></pre>

<p>Here is what it looks like for me:</p>

<pre><code>$ kubectl get all
NAME                                  READY     STATUS    RESTARTS   AGE
po/orientdbservice-4064909316-pzxhl   1/1       Running   0          1h

NAME                  CLUSTER-IP   EXTERNAL-IP   PORT(S)                         AGE
svc/orientdbservice   10.0.0.185   &lt;nodes&gt;       2480:31058/TCP,2424:30671/TCP   1h

NAME                     DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deploy/orientdbservice   1         1         1            1           1h

NAME                            DESIRED   CURRENT   READY     AGE
rs/orientdbservice-4064909316   1         1         1         1h

$ kubectl get cm
NAME              DATA      AGE
orientdb-config   8         1h

$ kubectl get pvc
NAME                 STATUS    VOLUME                                     CAPACITY   ACCESSMODES   STORAGECLASS   AGE
orientdb-backup      Bound     pvc-9c1507ea-8253-11e7-9e2b-52540058bb88   10Gi       RWO           standard       1h
orientdb-databases   Bound     pvc-9c00ca83-8253-11e7-9e2b-52540058bb88   10Gi       RWO           standard       1h
</code></pre>

<p>The config generated above might look little different, it was auto generated from the tool called <a href="https://github.com/kedgeproject/kedge" rel="nofollow noreferrer">kedge</a> see the instructions of how I did it in this gist: <a href="https://gist.github.com/surajssd/6bbe43a1b2ceee01962e0a1480d8cb04" rel="nofollow noreferrer">https://gist.github.com/surajssd/6bbe43a1b2ceee01962e0a1480d8cb04</a></p>
