<p>I have a use case where there will be telecom application running within the several pods(every pod will host some configured service for billing for specific client) and this expects the service to store the state so obvious choice is statefulset .
Now the problem is I need to use iscsi as storage in the backend for these pods, Can you please point me to some reference to such use case - I am looking for Yaml for PV PVC and statefulset and how to link them . These PV PVC shall use iscsi as storage option.</p>

<p>Yes you are right <code>statefulset</code> is option however you might can also use the <code>deployment</code>.</p>
<p>You have not mentioned which <code>cloud provider</code> you will be using but still sharing one <strong>note</strong> : <code>iscsi storage</code> is not optimized with <strong>GKE cotnainer OS</strong> running K8s nodes so if you are no <strong>GCP GKE</strong> change OS or would suggest using the <strong>Ubuntu</strong> image first.</p>
<p>You can start the <code>iscsi</code> service on the <code>Ubuntu</code> first.</p>
<p>You can use the <code>Minio</code> or <code>OpenEBS</code> for the storage option also.</p>
<p>Sharing the details if for OpenEBS</p>
<p>Create GCP disks for attaching nodes as a mount or you can dynamically provision it using the YAML as per need.</p>
<pre><code>apiVersion: openebs.io/v1alpha1
kind: StoragePoolClaim
metadata:
  name: disk-pool
  annotations:
    cas.openebs.io/config: |
      - name: PoolResourceRequests
        value: |-
            memory: 2Gi
      - name: PoolResourceLimits
        value: |-
            memory: 4Gi
spec:
  name: disk-pool
  type: disk
  poolSpec:
    poolType: striped
  blockDevices:
    blockDeviceList:
- blockdevice-&lt;Number&gt;   
- blockdevice-&lt;Number&gt; 
- blockdevice-&lt;Number&gt;  
</code></pre>
<p>Stoage class</p>
<pre><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: openebs-sc-rep1
  annotations:
    openebs.io/cas-type: cstor
    cas.openebs.io/config: |
      - name: StoragePoolClaim
        value: &quot;disk-pool&quot;
      - name: ReplicaCount
        value: &quot;1&quot;
provisioner: openebs.io/provisioner-iscsi
</code></pre>
<p>Application workload</p>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: web
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: k8s.gcr.io/nginx-slim:0.8
        volumeMounts:
        - name: www
          mountPath: /usr/share/nginx/html
  volumeClaimTemplates: 
  - metadata:
      name: www
    spec:
      accessModes: [ &quot;ReadWriteOnce&quot; ]
      resources:
        requests:
          storage: 1Gi
      storageClassName: openebs-sc-rep1
</code></pre>
<p>if you are on <code>AWS</code> <strong>EBS</strong> using the <code>iscsi</code>.
For testing you can also checkout</p>
<p><a href="https://cloud.ibm.com/catalog/content/minio" rel="nofollow noreferrer">https://cloud.ibm.com/catalog/content/minio</a></p>
<p>Few links :</p>
<ul>
<li><a href="https://support.zadarastorage.com/hc/en-us/articles/360039289891-Kubernetes-CSI-Getting-started-with-Zadara-CSI-on-GKE-Google-Kubernetes-Engine-" rel="nofollow noreferrer">https://support.zadarastorage.com/hc/en-us/articles/360039289891-Kubernetes-CSI-Getting-started-with-Zadara-CSI-on-GKE-Google-Kubernetes-Engine-</a></li>
</ul>
