Kubernetes 로컬 스토리지 PVC가 보류 중 상태에서 멈춤-해결 방법?

Nov 12 2020

kubernetes에서 로컬 스토리지 PVC를 올바르게 사용하는 방법에 대한 도움말을 찾고 있습니다.

로컬 스토리지 프로비저닝 도구가 활성화 된 Ubuntu에서 kubespray 클러스터를 프로비저닝했습니다.

다음과 같이 로컬 스토리지 프로비저닝 도구를 사용하는 상태 저장 세트를 배포하려고합니다.

apiVersion: apps/v1
kind: StatefulSet
metadata:
  namespace: ps
  name: ps-r
spec:
  selector:
    matchLabels:
      infrastructure: ps
      application: redis
      environment: staging
  serviceName: hl-ps-redis
  replicas: 1
  template:
    metadata:
      namespace: ps
      labels:
        infrastructure: ps
        application: redis
        environment: staging
    spec:
      terminationGracePeriodSeconds: 10
      containers:
        - name: ps-redis
          image: 1234567890.dkr.ecr.us-west-2.amazonaws.com/redis:latest
          ports:
            - containerPort: 6379
              protocol: TCP
              name: redis
          volumeMounts:
            - name: ps-redis-redis
              mountPath: /data
  volumeClaimTemplates:
    - metadata:
        namespace: project-stock
        name: ps-redis-redis
        labels:
          infrastructure: ps
          application: redis
          environment: staging
      spec:
        storageClassName: local-storage
        accessModes: [ "ReadWriteOnce" ]
        resources:
          requests:
            storage: 1Gi

PVC를 작성 중이지만 보류 상태로 멈 춥니 다.

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: ps-redis-redis-ps-r-0
  namespace: project-stock
  selfLink: >-
    /api/v1/namespaces/project-stock/persistentvolumeclaims/ps-redis-redis-ps-r-0
  uid: 2fac22e3-c3dc-4cbf-aeed-491f12b430e8
  resourceVersion: '384774'
  creationTimestamp: '2020-11-10T08:25:39Z'
  labels:
    application: redis
    environment: staging
    infrastructure: ps
  finalizers:
    - kubernetes.io/pvc-protection
  managedFields:
    - manager: kube-controller-manager
      operation: Update
      apiVersion: v1
      time: '2020-11-10T08:25:39Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:labels':
            .: {}
            'f:application': {}
            'f:environment': {}
            'f:infrastructure': {}
        'f:spec':
          'f:accessModes': {}
          'f:resources':
            'f:requests':
              .: {}
              'f:storage': {}
          'f:storageClassName': {}
          'f:volumeMode': {}
        'f:status':
          'f:phase': {}
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: local-storage
  volumeMode: Filesystem
status:
  phase: Pending

스토리지 등급 :

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage
  selfLink: /apis/storage.k8s.io/v1/storageclasses/local-storage
  uid: c29adff6-a8a2-4705-bb3b-155e1f7c13a3
  resourceVersion: '1892'
  creationTimestamp: '2020-11-09T12:09:56Z'
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: >
      {"apiVersion":"storage.k8s.io/v1","kind":"StorageClass","metadata":{"annotations":{},"name":"local-storage"},"provisioner":"kubernetes.io/no-provisioner","volumeBindingMode":"WaitForFirstConsumer"}
  managedFields:
    - manager: kubectl
      operation: Update
      apiVersion: storage.k8s.io/v1
      time: '2020-11-09T12:09:56Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            .: {}
            'f:kubectl.kubernetes.io/last-applied-configuration': {}
        'f:provisioner': {}
        'f:reclaimPolicy': {}
        'f:volumeBindingMode': {}
provisioner: kubernetes.io/no-provisioner
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer

포드가 시작되지 않았습니다. 0/2 개의 노드를 사용할 수 있습니다. 1 개의 CPU가 부족하고 1 개의 노드가 바인딩 할 사용 가능한 영구 볼륨을 찾지 못했습니다.

우리가 뭘 잘못하고 있습니까?

답변

1 roman Nov 24 2020 at 02:33

우리는 마침내이 작업을 https://github.com/rancher/local-path-provisioner 제대로 구성하는 것이 훨씬 쉽습니다.