I have a NATS Helm Chart that when initially ran will build the needed statefulsets and pvc's (provided I supply the pv's)
3 Replica Statefulsets (created by the helm chart)
- nats-0
- nats-1
- nats-2
3 corresponding Persistent Volumes (provided by me and placed in the infra folder).
apiVersion: v1
kind: PersistentVolume
metadata:
name: nats-pv-0
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: standard
hostPath:
path: /data/my-nats-pv-0
apiVersion: v1
kind: PersistentVolume
metadata:
name: nats-pv-0
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: standard
hostPath:
path: /data/my-nats-pv-0
apiVersion: v1
kind: PersistentVolume
metadata:
name: nats-pv-1
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: standard
hostPath:
path: /data/my-nats-pv-2
3 Resulting Persistent Volume Claims (Generated by helm chart)
- nats-js-pvc-nats-0
- nats-js-pvc-nats-1
- nats-js-pvc-nats-2
Yet, when I want to reconnect to them after a restart of the cluster, I can't get them to claim the previously created pvcs'.
Instead, I get indefinitely stalled pods that, according to the kubectl describe nats-/*(POD#)*/
cannot find the PVC. This is the portion of the helm chart responsible for pvc claiming. The pvs and pvcs are persistent and bound together. How do I make the NATS Helm chart create new stateful sets that will claim the existing PVCs? I am NOT sure that I am filling out the existingClaims
section right. THANKS!
I have tried the following:
Attempt #1
############################
# #
# Jetstream File Storage #
# #
############################
fileStorage:
enabled: true
storageDirectory: /data
# Set for use with existing PVC
existingClaim: nats-js-pvc-$(POD_NAME)
#jetstream-pvc
claimStorageSize: 1Gi
# Use below block to create new persistent volume
# only used if existingClaim is not specified
# size: 1Gi
# storageClassName: standard
# accessModes:
# - ReadWriteOnce
# annotations:
# key: "value"
# Use below if fileStorage is not enabled but you are persisting
# data using an alternative to PVC (e.g. hostPath)
# These set the corresponding jetstream configuration in nats.conf.
# store_dir: "/data"
# max_file: "10Gi"
Attempt #2
############################
# #
# Jetstream File Storage #
# #
############################
fileStorage:
enabled: true
storageDirectory: /data
# Set for use with existing PVC
existingClaim:
- name: nats-js-pvc-nats-0
- name: nats-js-pvc-nats-1
- name: nats-js-pvc-nats-2
#jetstream-pvc
claimStorageSize: 1Gi
# Use below block to create new persistent volume
# only used if existingClaim is not specified
# size: 1Gi
# storageClassName: standard
# accessModes:
# - ReadWriteOnce
# annotations:
# key: "value"
# Use below if fileStorage is not enabled but you are persisting
# data using an alternative to PVC (e.g. hostPath)
# These set the corresponding jetstream configuration in nats.conf.
# store_dir: "/data"
# max_file: "10Gi"
Attempt #3
############################
# #
# Jetstream File Storage #
# #
############################
fileStorage:
enabled: true
storageDirectory: /data
# Set for use with existing PVC
existingClaim:
- name: nats-js-pvc-nats-0
claimStorageSize: 1Gi
- name: nats-js-pvc-nats-1
claimStorageSize: 1Gi
- name: nats-js-pvc-nats-2
claimStorageSize: 1Gi
# Use below block to create new persistent volume
# only used if existingClaim is not specified
# size: 1Gi
# storageClassName: standard
# accessModes:
# - ReadWriteOnce
# annotations:
# key: "value"
# Use below if fileStorage is not enabled but you are persisting
# data using an alternative to PVC (e.g. hostPath)
# These set the corresponding jetstream configuration in nats.conf.
# store_dir: "/data"
# max_file: "10Gi"
Attempt #4
############################
# #
# Jetstream File Storage #
# #
############################
fileStorage:
enabled: true
storageDirectory: /data
# Set for use with existing PVC
existingClaim: [nats-js-pvc-nats-0,nats-js-pvc-nats-1,nats-js-pvc-nats-2]
#jetstream-pvc
claimStorageSize: 1Gi
# Use below block to create new persistent volume
# only used if existingClaim is not specified
# size: 1Gi
# storageClassName: standard
# accessModes:
# - ReadWriteOnce
# annotations:
# key: "value"
# Use below if fileStorage is not enabled but you are persisting
# data using an alternative to PVC (e.g. hostPath)
# These set the corresponding jetstream configuration in nats.conf.
# store_dir: "/data"
# max_file: "10Gi"
Edit #1: Also tried nats-js-pvc-$(POD_NAME), nats-js-pvc-(POD_NAME)