Yes,
hostPath can work, with limitations. Any
hostPath volumes are exclusively used for single node clusters. If your pod moves to another node in a multi-node cluster, your
hostPath storage doesn't move with it. The following configuration will not handle multi-node clusters or a node failure, so use this only for simple testing.
Instead, the recommended solutions for multi-node clusters are to use NFS mounts (for EKS and OpenShift), as described in the ModelOps documentation. For Azure use an Azure File Share.
STEPS TO USE hostPath VOLUME CONFIGURATION...
1. Run Lens. In the "Nodes" view identify the nodes running the cluster. Select the node to use for storage. You should be able to open a terminal there and you
will be 'root'. Run the following commands from that terminal.
Note that you are only
running Lens on Windows. It connects to your AKS Cluster and your new volume is in the Linux cluster, not on Windows. The following commands are to be run in the node that represents your storage volume (the
PersistentVolume nodes created by the '
kubectl' examples that follow).
2. Create the File Source VolumeSource 10GB Persistent Volume
kubectl apply -f - <<!
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume-source
labels:
type: local
usage: task-pv-volume-source
annotations:
description: "file-datasource-local"
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/tmp/source"
!
Source 10GB Persistent Volume Claim
kubectl apply -f - <<!
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: task-pv-claim
namespace: datachannels
annotations:
description: "file-datasource-local"
volume.beta.kubernetes.io/storage-class: ""
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
selector:
matchLabels:
usage: task-pv-volume-source
!
3. Create the File Sink VolumeSink 10GB Persistent Volume
kubectl apply -f - <<!
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume-sink
labels:
type: local
usage: task-pv-volume-sink
annotations:
description: "file-datasink-local"
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/tmp/sink"
!
Sink 10GB Persistent Volume Claim
kubectl apply -f - <<!
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: task-pv-claim-sink
namespace: datachannels
annotations:
description: "file-datasink-local"
volume.beta.kubernetes.io/storage-class: ""
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
selector:
matchLabels:
usage: task-pv-volume-sink
!
4. Open the directory permissions for write
chmod 777 /tmp/sink
After these commands are run you may create Source and Sink channels in your single ModelOps instance. Only use this configuration for temporary testing.