2

我想在 Kubernetes 上为本地 SQL 2019 大数据设置简单的持久存储。但是不断抛出一个事件'pod has unbound immediate PersistentVolumeClaims'。

当我部署映像时,pod mssql-controller 显示一个事件:

Name:               mssql-controller-6vd8b
Namespace:          sql2019
Priority:           0
PriorityClassName:  <none>
Node:               <none>
Labels:             MSSQL_CLUSTER=sql2019
                    app=mssql-controller
Annotations:        <none>
Status:             Pending
IP:
Controlled By:      ReplicaSet/mssql-controller
Containers:
  mssql-controller:
    Image:      private-repo.microsoft.com/mssql-private-preview/mssql-controller:latest
    Port:       8081/TCP
    Host Port:  0/TCP
    Environment:
      ACCEPT_EULA:                  Y
      CONTROLLER_ENABLE_TDS_PROXY:  false
      KUBERNETES_NAMESPACE:         sql2019 (v1:metadata.namespace)
    Mounts:
      /root/secrets/controller-db from controller-db-secret (ro)
      /root/secrets/controller-login from controller-login-secret (ro)
      /root/secrets/knox from controller-knox-secret (ro)
      /root/secrets/node-admin-login from node-admin-login-secret (ro)
      /var/opt from controller-storage (rw)
      /var/opt/controller/config from controller-config-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from sa-mssql-controller-token-4fsbc (ro)
  mssql-portal:
    Image:        private-repo.microsoft.com/mssql-private-preview/mssql-portal:latest
    Port:         6001/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:
      /var/opt from controller-storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from sa-mssql-controller-token-4fsbc (ro)
  mssql-server-controller:
    Image:      private-repo.microsoft.com/mssql-private-preview/mssql-server-controller:latest
    Port:       1433/TCP
    Host Port:  0/TCP
    Environment:
      ACCEPT_EULA:  Y
      SA_PASSWORD:  <password removed>
    Mounts:
      /var/opt from controller-storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from sa-mssql-controller-token-4fsbc (ro)
  mssql-monitor-fluentbit:
    Image:      private-repo.microsoft.com/mssql-private-preview/mssql-monitor-fluentbit:latest
    Port:       2020/TCP
    Host Port:  0/TCP
    Limits:
      memory:  100Mi
    Requests:
      cpu:     100m
      memory:  100Mi
    Environment:
      FLUENT_ELASTICSEARCH_HOST:  service-monitor-elasticsearch
      FLUENT_ELASTICSEARCH_PORT:  9200
      FLUENTBIT_CONFIG:           fluentbit-controller.conf
      KUBERNETES_NAMESPACE:       sql2019 (v1:metadata.namespace)
      KUBERNETES_NODE_NAME:        (v1:spec.nodeName)
      KUBERNETES_POD_NAME:        mssql-controller-6vd8b (v1:metadata.name)
    Mounts:
      /var/opt from controller-storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from sa-mssql-controller-token-4fsbc (ro)
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  controller-storage:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  mssql-controller-pvc
    ReadOnly:   false
  controller-login-secret:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  controller-login-secret
    Optional:    false
  controller-db-secret:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  controller-db-secret
    Optional:    false
  controller-knox-secret:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  controller-knox-secret
    Optional:    false
  node-admin-login-secret:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  node-admin-login-secret
    Optional:    false
  controller-config-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      mssql-controller-config
    Optional:  false
  sa-mssql-controller-token-4fsbc:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  sa-mssql-controller-token-4fsbc
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age              From               Message
  ----     ------            ----             ----               -------
  Warning  FailedScheduling  1s (x6 over 4s)  default-scheduler  pod has unbound immediate PersistentVolumeClaims

集群配置:

export USE_PERSISTENT_VOLUME=true
export STORAGE_CLASS_NAME=slow

存储类.yaml

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: slow
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/gce-pd
parameters:
  type: pd-standard
  replication-type: none

我对 Kubernetes 很陌生,但这些是我所知道的:

  • 我需要动态卷配置
  • 我需要创建存储类(SQL 2019 创建持久卷和持久卷声明)
4

1 回答 1

0

就我而言,它是在使用 minikube 时发生的。我相信它甚至可以发生在任何云提供商上。

这样做的原因是因为一个或多个 PVC 的存储规范要求的磁盘空间可能比可用的更多。

检查你的

...
resources:
  requests:
    storage: <value must be <= than available space>

我希望这可以帮助别人。

于 2019-07-17T10:20:44.560 回答