I will be running a pod with persistent SSD. I already have the disk ready (created from snapshot) I want to attach this disk to a pod. So far, I have been creating the pod in this manner
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: geth-stateful
namespace: dev
spec:
serviceName: geth-dev-service
replicas: 2
selector:
matchLabels:
app: geth-node
template:
metadata:
labels:
app: geth-node
spec:
containers:
- name: geth-node
image: asia.gcr.io/indiesquare-dev/geth-node:v1.8.12
ports:
volumeMounts:
- name: geth-chaindata
mountPath: /var/tmp
resources:
requests:
memory: "13Gi"
cpu: "5000m"
limits:
memory: "14Gi"
cpu: "5500m"
volumeClaimTemplates:
- metadata:
name: geth-chaindata
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: fast
resources:
requests:
storage: 500Gi
However, this always creates a new disk. Is there a way to provide an already existing disk as volumeMounts
?
If you claim a volume without first having a PVC on GKE, Google Cloud Platform will provision a new disk for you each time to meet the claim.
Since you already have the disk created and prepared, you want to configure a Persistent Volume first that uses the preexisting disk and a Persistent Volume Claim to consume it.