代码之家  ›  专栏  ›  技术社区  ›  Yuri Astrakhan

k8s无法在GCP上调度本地ssd卷

  •  2
  • Yuri Astrakhan  · 技术社区  · 6 年前

    我正在尝试将Google云中的本地SSD指定为 PersistedVolume . 我跟着警察走 docs automated SSD provisioning ,并运行 kubectl get pv

    NAME                CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM     STORAGECLASS   REASON    AGE
    local-pv-9721c951   368Gi      RWO            Delete           Available             local-scsi               1h
    

    kubectl get pvc 不断展示:

    NAME      STATUS    VOLUME    CAPACITY   ACCESS MODES   STORAGECLASS   AGE
    mapdata   Pending                                       local-scsi     7m
    

    kubectl get events 给我这些:

    LAST SEEN   FIRST SEEN   COUNT     NAME                                                KIND                    SUBOBJECT   TYPE      REASON                 SOURCE                        MESSAGE
    7m          7m           1         v3tiles.1551c0bbcb23d983                            Service                             Normal    EnsuredLoadBalancer    service-controller            Ensured load balancer
    2m          8m           24        maptilesbackend-8645566545-x44nl.1551c0ae27d06fca   Pod                                 Warning   FailedScheduling       default-scheduler             0/1 nodes are available: 1 node(s) didn't find available persistent volumes to bind.
    2m          8m           26        mapdata.1551c0adf908e362                            PersistentVolumeClaim               Normal    WaitForFirstConsumer   persistentvolume-controller   waiting for first consumer to be created before binding
    

    我需要怎么做才能把SSD绑定到我的pod上?下面是我一直在尝试的代码:

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: maptilesbackend
      namespace: default
    spec:
      selector:
        matchLabels:
          app: maptilesbackend
      strategy:
        type: RollingUpdate
      template:
        metadata:
          labels:
            app: maptilesbackend
        spec:
          containers:
          - image: klokantech/openmaptiles-server
            imagePullPolicy: Always
            name: maptilesbackend
            volumeMounts:
              - mountPath: /data
                name: mapdata
                readOnly: true
          volumes:
            - name: mapdata
              persistentVolumeClaim:
                claimName: mapdata
                readOnly: true
    ---
    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: "local-scsi"
    provisioner: "kubernetes.io/no-provisioner"
    volumeBindingMode: "WaitForFirstConsumer"
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: mapdata
    spec:
      storageClassName: local-scsi
      accessModes:
        - ReadOnlyMany
      resources:
        requests:
          storage: 300Gi
    
    2 回复  |  直到 6 年前
        1
  •  3
  •   Rico    6 年前

    ReadOnlyMany 对本地SSD没有意义

    就绪许多卷可以由许多节点以只读方式装入

    不能在多个节点上装载本地SSD,因为它仅在一个节点上本地。

        2
  •  0
  •   Yuri Astrakhan    6 年前

    事实证明 accessMode: ReadOnlyMany