title: Installing database in Kubernetes
body: <p>I'm trying to install CockroachDB with Rancher and getting some problems, showing:</p>
  <pre><code>FailedBinding (5)   14 sec ago  no persistent volumes available for this claim and no storage class is set
  </code></pre>
  <p><strong>How can this be solved?</strong></p>
  <p>Here are the configurations in my local machine:</p>
  <p><strong>PersistentVolumeClaim: datadir-cockroachdb-0</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    creationTimestamp: &quot;2021-01-07T23:50:42Z&quot;
    finalizers:
    - kubernetes.io/pvc-protection
    labels:
      app.kubernetes.io/component: cockroachdb
      app.kubernetes.io/instance: cockroachdb
      app.kubernetes.io/name: cockroachdb
    managedFields:
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:labels:
            .: {}
            f:app.kubernetes.io/component: {}
            f:app.kubernetes.io/instance: {}
            f:app.kubernetes.io/name: {}
        f:spec:
          f:accessModes: {}
          f:resources:
            f:requests:
              .: {}
              f:storage: {}
          f:volumeMode: {}
        f:status:
          f:phase: {}
      manager: k3s
      operation: Update
      time: &quot;2021-01-07T23:50:41Z&quot;
    name: datadir-cockroachdb-0
    namespace: default
    resourceVersion: &quot;188922&quot;
    selfLink: /api/v1/namespaces/default/persistentvolumeclaims/datadir-cockroachdb-0
    uid: ef83d3c7-0309-44a8-b379-0134835d97a9
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 100Gi
    volumeMode: Filesystem
  status:
    phase: Pending
  
  </code></pre>
  <p><strong>CockroachDB</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>clusterDomain: cluster.local
  conf:
    attrs: []
    cache: 25%
    cluster-name: ''
    disable-cluster-name-verification: false
    http-port: 8080
    join: []
    locality: ''
    logtostderr: INFO
    max-disk-temp-storage: 0
    max-offset: 500ms
    max-sql-memory: 25%
    port: 26257
    single-node: false
    sql-audit-dir: ''
  image:
    credentials: {}
    pullPolicy: IfNotPresent
    repository: cockroachdb/cockroach
    tag: v20.1.3
  ingress:
    annotations: {}
    enabled: false
    hosts: []
    labels: {}
    paths:
      - /
    tls: []
  init:
    affinity: {}
    annotations: {}
    labels:
      app.kubernetes.io/component: init
    nodeSelector: {}
    resources: {}
    tolerations: []
  labels: {}
  networkPolicy:
    enabled: false
    ingress:
      grpc: []
      http: []
  service:
    discovery:
      annotations: {}
      labels:
        app.kubernetes.io/component: cockroachdb
    ports:
      grpc:
        external:
          name: grpc
          port: 26257
        internal:
          name: grpc-internal
          port: 26257
      http:
        name: http
        port: 8080
    public:
      annotations: {}
      labels:
        app.kubernetes.io/component: cockroachdb
      type: ClusterIP
  statefulset:
    annotations: {}
    args: []
    budget:
      maxUnavailable: 1
    env: []
    labels:
      app.kubernetes.io/component: cockroachdb
    nodeAffinity: {}
    nodeSelector: {}
    podAffinity: {}
    podAntiAffinity:
      type: soft
      weight: 100
    podManagementPolicy: Parallel
    priorityClassName: ''
    replicas: 3
    resources: {}
    secretMounts: []
    tolerations: []
    updateStrategy:
      type: RollingUpdate
  storage:
    hostPath: ''
    persistentVolume: volume1
      annotations: {}
      enabled: true
      labels: {}
      size: 1Gi
      storageClass: local-storage ''
  tls:
    certs:
      clientRootSecret: cockroachdb-root
      nodeSecret: cockroachdb-node
      provided: false
      tlsSecret: false
    enabled: false
    init:
      image:
        credentials: {}
        pullPolicy: IfNotPresent
        repository: cockroachdb/cockroach-k8s-request-cert
        tag: '0.4'
    serviceAccount:
      create: true
      name: ''
  Storage: 1Gi
  </code></pre>
  <p><strong>PersistentVolume</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
  kind: PersistentVolume
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: '{&quot;apiVersion&quot;:&quot;v1&quot;,&quot;kind&quot;:&quot;PersistentVolume&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;labels&quot;:{&quot;type&quot;:&quot;local&quot;},&quot;name&quot;:&quot;volume1&quot;},&quot;spec&quot;:{&quot;accessModes&quot;:[&quot;ReadWriteOnce&quot;],&quot;capacity&quot;:{&quot;storage&quot;:&quot;10Gi&quot;},&quot;hostPath&quot;:{&quot;path&quot;:&quot;/data/volume1&quot;}}}'
    creationTimestamp: &quot;2021-01-07T23:11:43Z&quot;
    finalizers:
    - kubernetes.io/pv-protection
    labels:
      type: local
    managedFields:
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          f:phase: {}
      manager: k3s
      operation: Update
      time: &quot;2021-01-07T23:11:43Z&quot;
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations: {}
          f:labels:
            .: {}
            f:type: {}
        f:spec:
          f:accessModes: {}
          f:capacity: {}
          f:hostPath:
            .: {}
            f:path: {}
            f:type: {}
          f:persistentVolumeReclaimPolicy: {}
          f:volumeMode: {}
      manager: kubectl
      operation: Update
      time: &quot;2021-01-07T23:11:43Z&quot;
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            f:kubectl.kubernetes.io/last-applied-configuration: {}
        f:spec:
          f:capacity:
            f:storage: {}
      manager: Go-http-client
      operation: Update
      time: &quot;2021-01-07T23:12:11Z&quot;
    name: volume1
    resourceVersion: &quot;173783&quot;
    selfLink: /api/v1/persistentvolumes/volume1
    uid: 6e76984c-22cd-4219-9ff6-ba7f67c1ca72
  spec:
    accessModes:
    - ReadWriteOnce
    capacity:
      storage: 4Gi
    hostPath:
      path: /data/volume1
      type: &quot;&quot;
    persistentVolumeReclaimPolicy: Retain
    volumeMode: Filesystem
  status:
    phase: Available
  
  </code></pre>
  <p><strong>StorageClass</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: storage.k8s.io/v1
  kind: StorageClass
  metadata:
    creationTimestamp: &quot;2021-01-07T23:29:17Z&quot;
    managedFields:
    - apiVersion: storage.k8s.io/v1
      fieldsType: FieldsV1
      fieldsV1:
        f:provisioner: {}
        f:reclaimPolicy: {}
        f:volumeBindingMode: {}
      manager: rancher
      operation: Update
      time: &quot;2021-01-07T23:29:17Z&quot;
    name: local-storage
    resourceVersion: &quot;180190&quot;
    selfLink: /apis/storage.k8s.io/v1/storageclasses/local-storage
    uid: 0a5f8b75-7fb5-4965-91ee-91b0a087339a
  provisioner: kubernetes.io/no-provisioner
  reclaimPolicy: Delete
  volumeBindingMode: WaitForFirstConsumer
  </code></pre>