Kubernetes和存储类光泽和可提

kh212irz  于 2023-03-01  发布在  Kubernetes
关注(0)|答案(1)|浏览(76)

我尝试在Kubernetes中设置StorageClass和PersistanceVolumeClaim,但现在遇到了无法正常工作的问题。
我所拥有的:

格卢斯特夫斯----南苏丹亚姆勒

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: gluster-heketi
provisioner: kubernetes.io/glusterfs
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
parameters:
  resturl: "http://server_ip:8080"
  restuser: "admin"
  restuserkey: "key"
  volumetype: "replicate:3"
  volumenameprefix: "vol"
  clusterid: "cluster_id"

玻璃纤维-聚氯乙烯.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
 name: gluster-pvc
spec:
 storageClassName: gluster-heketi
 accessModes:
  - ReadWriteMany
 resources:
   requests:
     storage: 1Gi

豆荚yaml

apiVersion: v1
kind: Pod
metadata:
  name: gluster-pod
  labels:
    name: gluster-pod
spec:
  containers:
  - name: gluster-pod
    image: busybox
    command: ["sleep", "60000"]
    volumeMounts:
    - name: gluster-vol
      mountPath: /usr/share/busybox
      readOnly: false
  volumes:
  - name: gluster-vol
    persistentVolumeClaim:
      claimName: gluster-pvc

PersistentVolumeClaim仍处于 * 挂起 * 状态,pod显示消息 “0/5个节点可用:pod具有未绑定的即时PersistentVolumeClaims。抢占:0/5个节点可用:5未找到传入Pod的抢占受害者..'
我期待这个教程https://computingforgeeks.com/configure-kubernetes-dynamic-volume-provisioning-with-heketi-glusterfs/

atmip9wb

atmip9wb1#

解决!

apiVersion: v1
kind: Endpoints
metadata:
  name: glusterfs-cluster
  labels:
    storage.k8s.io/name: glusterfs
    storage.k8s.io/part-of: kubernetes-complete-reference
    storage.k8s.io/created-by: ssbostan
subsets:
 - addresses:
  - ip: ipserver
ports:
  - port: port_number

在这之后..

apiVersion: v1
kind: PersistentVolume
metadata:
  name: glusterfs-volume
  labels:
    storage.k8s.io/name: glusterfs
    storage.k8s.io/part-of: kubernetes-complete-reference
    storage.k8s.io/created-by: ssbostan
spec:
  accessModes:
    - ReadWriteOnce
    - ReadOnlyMany
    - ReadWriteMany
  capacity:
    storage: 10Gi
  storageClassName: ""
  persistentVolumeReclaimPolicy: Recycle
  volumeMode: Filesystem
  glusterfs:
    endpoints: glusterfs-cluster
    path: k8s-volume
    readOnly: no

相关问题