说明
目前 LHC 未对接阿里云的 NAS 及云盘存储,若要使用存储功能,需要安装第三方存储插件。
前提条件
使用 NAS 创建多实例 StatefulSet
YAML 样例如下:
apiVersion: apps/v1beta2
kind:StatefulSet
metadata:
name: web
spec:
selector:
matchLabels:
app: nginx
serviceName:"<指定已有的Service>"
replicas:2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort:80
name: web
volumeMounts:
- name: csi-nas-pvc
mountPath:/data
volumeClaimTemplates:
- metadata:
name: csi-nas-pvc
spec:
accessModes:["ReadWriteOnce"]
storageClassName:"csi-nas-capacity"
resources:
requests:
storage:25G
使用云盘创建多实例 StatefulSet
YAML 样例如下:
apiVersion: apps/v1beta2
kind:StatefulSet
metadata:
name: web
spec:
selector:
matchLabels:
app: nginx
serviceName:"<指定已有的Service>"
replicas:2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort:80
name: web
volumeMounts:
- name: disk-efficiency
mountPath:/data
volumeClaimTemplates:
- metadata:
name: disk-efficiency
spec:
accessModes:["ReadWriteOnce"]
storageClassName:"csi-disk-efficiency"
resources:
requests:
storage:25G
参数说明参考 使用 PVC 挂载动态存储卷。
文档内容是否对您有帮助?