5

我正在尝试使用最新的稳定版通过 helm 安装 postgres ,但它没有正确安装持久卷。我正在将它安装在 Minikube 中,由于某种原因,它似乎无法正确托管安装。

错误(在部署、pod 和副本集上)

PersistentVolumeClaim 未绑定:“postgres-postgresql”错误:lstat /tmp/hostpath-provisioner/pvc-c713429d-e2a3-11e7-9ca9-080027231d54:没有这样的文件或目录同步 pod 错误

当我查看持久卷时,它似乎运行正常。万一这有帮助,我的持久卷 yaml:

{
  "kind": "PersistentVolume",
  "apiVersion": "v1",
  "metadata": {
    "name": "pvc-c713429d-e2a3-11e7-9ca9-080027231d54",
    "selfLink": "/api/v1/persistentvolumes/pvc-c713429d-e2a3-11e7-9ca9-080027231d54",
    "uid": "c71850e1-e2a3-11e7-9ca9-080027231d54",
    "resourceVersion": "396568",
    "creationTimestamp": "2017-12-16T20:57:50Z",
    "annotations": {
      "hostPathProvisionerIdentity": "8979806c-dfba-11e7-862f-080027231d54",
      "pv.kubernetes.io/provisioned-by": "k8s.io/minikube-hostpath"
    }
  },
  "spec": {
    "capacity": {
      "storage": "8Gi"
    },
    "hostPath": {
      "path": "/tmp/hostpath-provisioner/pvc-c713429d-e2a3-11e7-9ca9-080027231d54",
      "type": ""
    },
    "accessModes": [
      "ReadWriteOnce"
    ],
    "claimRef": {
      "kind": "PersistentVolumeClaim",
      "namespace": "default",
      "name": "postgres-postgresql",
      "uid": "c713429d-e2a3-11e7-9ca9-080027231d54",
      "apiVersion": "v1",
      "resourceVersion": "396550"
    },
    "persistentVolumeReclaimPolicy": "Delete",
    "storageClassName": "standard"
  },
  "status": {
    "phase": "Bound"
  }
}

持久卷声明 Yaml:

{
  "kind": "PersistentVolumeClaim",
  "apiVersion": "v1",
  "metadata": {
    "name": "postgres-postgresql",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/persistentvolumeclaims/postgres-postgresql",
    "uid": "c713429d-e2a3-11e7-9ca9-080027231d54",
    "resourceVersion": "396588",
    "creationTimestamp": "2017-12-16T20:57:50Z",
    "labels": {
      "app": "postgres-postgresql",
      "chart": "postgresql-0.8.3",
      "heritage": "Tiller",
      "release": "postgres"
    },
    "annotations": {
      "control-plane.alpha.kubernetes.io/leader": "{\"holderIdentity\":\"897980a2-dfba-11e7-862f-080027231d54\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2017-12-16T20:57:50Z\",\"renewTime\":\"2017-12-16T20:57:52Z\",\"leaderTransitions\":0}",
      "pv.kubernetes.io/bind-completed": "yes",
      "pv.kubernetes.io/bound-by-controller": "yes",
      "volume.beta.kubernetes.io/storage-provisioner": "k8s.io/minikube-hostpath"
    }
  },
  "spec": {
    "accessModes": [
      "ReadWriteOnce"
    ],
    "resources": {
      "requests": {
        "storage": "8Gi"
      }
    },
    "volumeName": "pvc-c713429d-e2a3-11e7-9ca9-080027231d54",
    "storageClassName": "standard"
  },
  "status": {
    "phase": "Bound",
    "accessModes": [
      "ReadWriteOnce"
    ],
    "capacity": {
      "storage": "8Gi"
    }
  }
}

任何援助将不胜感激。

4

1 回答 1

5

您可能会遇到这个问题:https ://github.com/kubernetes/minikube/issues/2256

问题是主机路径卷配置程序中存在一个错误,当部署资源中存在“子路径”字段时遇到错误(如果该字段具有空值则发生事件)。

这是一个对我有用的解决方法 - 解压缩 postgresql 图表并在 deployment.yaml 中注释掉以下行:

      # subPath: {{ .Values.persistence.subPath }}

然后重新部署修改后的图表。如果您依赖 'subPath' 字段,则此解决方法对您不起作用。

注意:这个问题也出现在 Docker-for-Mac 上的 Kubernetes 上(这是我遇到的地方)。

于 2018-01-16T22:56:48.417 回答