I am trying to setup a high availability cluster with storageOS.Literally i want to replicate volumes between nodes and if a node down my statefull application should start on new node with last state.
I have 1 Master and 2 Slave nodes on bare metal(virtualbox).I succesfully installed storageos with helm according to those docs: https://docs.storageos.com/docs/platforms/kubernetes/install/1.13
I can reach the web gui of storageos on browser and everything seems like fine.I also create storageclass succesfully.
I try to create a persistent volume claim and bind to a pod.After pvc and pod created , pv is succesfully produce and bound to claim.I chech it from browser and there is 1 replica and 1 master persistent volume on nodes.There is no problem until here.
when i poweroff the node of pod and restart the pod on the other node , the pod stucks on container creating state.Describe command gives that results:
Warning FailedAttachVolume 23s attachdetach-controller Multi-Attach error for volume "pvc-0b2a1dbf-62e4-11e9-8b86-0800278a3f7b" Volume is already used by pod(s) nginx, nginx-6779c9f48b-g2825
I follow this guide and the pod must start on the other node with same state: https://docs.storageos.com/docs/platforms/kubernetes/firstvolume/
I check this diretory on nodes"/var/lib/storageos/volumes" and pods and i can see the volumes in the one node (which has the persistent volume) but i can not see any volumes on the other node.
I tried:
Change pv reclaim policy
A little try with openebs but same issue
I try this troubleshooting result is same: https://docs.storageos.com/docs/platforms/kubernetes/troubleshoot/volumes#pod-in-pending-because-of-mount-error (i try only for docker i do not know how to enable MountPropagation on kubernetes)
I tried waiting for 15-20 minute but error state still same
I tried with 1 master and 3 slave node result is same
Secret and Cluster
apiVersion: v1
kind: Secret
metadata:
name: "storageos-api"
namespace: "default"
labels:
app: "storageos"
type: "kubernetes.io/storageos"
data:
# echo -n '<secret>' | base64
apiUsername: c3RvcmFnZW9z
apiPassword: c3RvcmFnZW9z
---
apiVersion: "storageos.com/v1"
kind: "StorageOSCluster"
metadata:
name: "example-storageos"
namespace: "default"
spec:
secretRefName: "storageos-api"
secretRefNamespace: "default"
---
PVC and Pod
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mpvc
labels:
storageos.com/replicas: "1"
annotations:
volume.beta.kubernetes.io/storage-class: fast
spec:
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
securityContext:
privileged: true
volumeMounts:
- mountPath: /usr/share/nginx/html/
name: v1
volumes:
- name: v1
persistentVolumeClaim:
claimName: mpvc
The pod must start on the other node when a node fails but cannot bind the same volume on new node