# Azure kubernetes services, azure stack HCI

**URL:** <https://discuss.elastic.co/t/azure-kubernetes-services-azure-stack-hci/308913>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Tags:** docker\
**Created:** [July 5, 2022, 12:55pm UTC](https://discuss.elastic.co/t/azure-kubernetes-services-azure-stack-hci/308913 "2022-07-05T12:55:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![splitmessage88](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@splitmessage88](https://discuss.elastic.co/u/splitmessage88)\
**Post date:** [July 5, 2022, 12:55pm UTC](https://discuss.elastic.co/t/azure-kubernetes-services-azure-stack-hci/308913/1 "2022-07-05T12:55:11Z")

</div>

Hi,  
I try to create a persistent volume with kubernetes but I get the following error message:  
0/2 nodes are available: 2 node(s) didn't find available persistent volumes to bind.

AKS (azure kubernetes services) on azure stack hci, so this is a on-premise solution.  
I have a 2 node failover cluster, so I try to set this up with local disks (SSD/HDD).

My setup

```auto
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: my-local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: hot-pv-volume
spec:
  capacity:
    storage: 200Gi
  accessModes:
  - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: my-local-storage
  local:
    path: D:/eshot/vol1
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - moc-xxxx
          - moc-xxxx
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: hot-pv-claim
spec:
  accessModes:
  - ReadWriteMany
  storageClassName: my-local-storage
  resources:
    requests:
      storage: 200Gi
---
---
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: esdeployment01t
spec:
  version: 8.3.0
  nodeSets:
  - name: masters
    count: 3
    config:
      node.roles: ["master"]
      xpack.ml.enabled: true
      node.store.allow_mmap: false
    podTemplate:
      spec:
        containers:
        resources:
          requests:
            memory: 2Gi
            cpu: 0.5
          limits:
            memory: 2Gi
    volumeClaimTemplates:
      - metadata:
          name: elasticsearch-data
        spec:
          accessModes:
            - ReadWriteMany
          resources:
            requests:
              storage: 2Gi
          storageClassName: my-local-storage

```

---

<div class="post-metadata">

**Author:** ![michael.morello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.morello/32/47448_2.png) [@michael.morello](https://discuss.elastic.co/u/michael.morello)\
**Post date:** [July 7, 2022, 6:55am UTC](https://discuss.elastic.co/t/azure-kubernetes-services-azure-stack-hci/308913/2 "2022-07-07T06:55:43Z")

</div>

`PersistentVolumeClaim` are created automatically by the `StatefulSet` controller. Using your example you should have the following ones created, and in a `Pending` state:

```auto
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
elasticsearch-data-esdeployment01t-es-masters-0 Pending standard 3s
elasticsearch-data-esdeployment01t-es-masters-1 Pending standard 3s
elasticsearch-data-esdeployment01t-es-masters-2 Pending standard 3s

```

Either matching `PersistentVolumes` already exist, or they are provisioned dynamically. Given that local storage does not support dynamic provisioning ([see k8s doc here](https://kubernetes.io/docs/concepts/storage/storage-classes/)) then you should create them in advance. Could you check that there's actually 3x matching local `PersistentVolumes`?

---

<div class="post-metadata">

**Author:** ![splitmessage88](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@splitmessage88](https://discuss.elastic.co/u/splitmessage88)\
**Post date:** [July 12, 2022, 8:47am UTC](https://discuss.elastic.co/t/azure-kubernetes-services-azure-stack-hci/308913/4 "2022-07-12T08:47:45Z")

</div>

Hi michael,

No, I don't have three persistent volumes only 1. The other ones are in "pending" state.

To be able to use local storage, do I need to create 3 persistent volumes and apply them to my pods manually? How can I create 3 identical PV and apply them to my pods and will the elasticsearch nodes be able to replicate/communicate with each other?

Thank you!

**My configuration**

**Persistent volume claim**

```auto
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
elasticsearch-data-esdeployment01t-es-master-0 Bound test-local-pv 50Gi RWO local-storage 3m1s
elasticsearch-data-esdeployment01t-es-master-1 Pending local-storage 3m1s
elasticsearch-data-esdeployment01t-es-master-2 Pending local-storage 3m1s

```

**Pods**

```auto

NAME READY STATUS RESTARTS AGE
esdeployment01t-es-master-0 1/1 Running 0 8m56s
esdeployment01t-es-master-1 0/1 Pending 0 8m56s
esdeployment01t-es-master-2 0/1 Pending 0 8m55s

```

**Persistent Volume**

```auto
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
test-local-pv 50Gi RWO Retain Bound default/elasticsearch-data-esdeployment01t-es-master-0 local-storage 26m

```

**Part 2 EDIT**  
Hi,  
I believe I found the solution but I would like to have elastics opinion regarding my solution before implementing this in prod.

Azure stack hci aks have a csi driver plugin which you can use to create a Kubernetes _DataDisk_ resource. These are mounted as ReadWriteOnce, I guess this is the way elasticsearch should function, since each ES-instance is running in its on pod right? Each pod is reading/writing to its own .vhdx disk/file.

**link**  
[azure-stack-docs/container-storage-interface-disks.md at main · MicrosoftDocs/azure-stack-docs · GitHub](https://github.com/MicrosoftDocs/azure-stack-docs/blob/main/azure-stack/aks-hci/container-storage-interface-disks.md))

We are using storage spaces direct (S2D) and will implement three-way-mirroring, that is 3 nodes with each node having its own copy of the data. Will this setup work or should we use another solution? (NFS/SMB)

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 9, 2022, 8:48am UTC](https://discuss.elastic.co/t/azure-kubernetes-services-azure-stack-hci/308913/5 "2022-08-09T08:48:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
