Closed
Description
Description
Failed to use LocalPV hostpath, please help!
Pod stuck in ContainerCreating and I got the following error in the log:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 12m default-scheduler Successfully assigned consul/consul-0 to internal-k8s-master1
Warning FailedMount 94s (x13 over 11m) kubelet, MountVolume.NewMounter initialization failed for volume "pvc-4121ec0e-e815-11e9-a58e-00163e1274b8" : path "/data/openebs/local/pvc-4121ec0e-e815-11e9-a58e-00163e1274b8" does not exist
Warning FailedMount 93s (x5 over 10m) kubelet, Unable to mount volumes for pod "consul-0_consul(49a26f4a-e81c-11e9-a58e-00163e1274b8)": timeout expired waiting for volumes to attach or mount for pod "consul"/"consul-0". list of unmounted volumes=[data]. list of unattached volumes=[data default-token-t5gfh]
But if I check the path on the node, the directory actually got created:
[root@ local]# pwd
/data/openebs/local
[root@ local]# ll
total 4
drwxrwxrwx 2 root root 4096 Oct 6 16:42 pvc-4121ec0e-e815-11e9-a58e-00163e1274b8
StorageClass "openebs-hostpath":
{
"apiVersion": "storage.k8s.io/v1",
"kind": "StorageClass",
"metadata": {
"annotations": {
"cas.openebs.io/config": "- name: StorageType\n value: \"hostpath\"\n- name: BasePath\n value: \"/data/openebs/local\"\n",
"openebs.io/cas-type": "local"
},
"creationTimestamp": "2019-10-05T04:18:51Z",
"name": "openebs-hostpath",
"resourceVersion": "290797",
"selfLink": "/apis/storage.k8s.io/v1/storageclasses/openebs-hostpath",
"uid": "3cb4438c-e727-11e9-8934-00163e1274b8"
},
"provisioner": "openebs.io/local",
"reclaimPolicy": "Delete",
"volumeBindingMode": "WaitForFirstConsumer"
}
PVC:
{
"apiVersion": "v1",
"kind": "PersistentVolumeClaim",
"metadata": {
"annotations": {
"pv.kubernetes.io/bind-completed": "yes",
"pv.kubernetes.io/bound-by-controller": "yes",
"volume.beta.kubernetes.io/storage-provisioner": "openebs.io/local",
"volume.kubernetes.io/selected-node": "internal-k8s-master1"
},
"creationTimestamp": "2019-10-06T08:42:39Z",
"finalizers": [
"kubernetes.io/pvc-protection"
],
"labels": {
"app": "consul",
"release": "consul"
},
"name": "data-consul-0",
"namespace": "consul",
"resourceVersion": "292898",
"selfLink": "/api/v1/namespaces/consul/persistentvolumeclaims/data-consul-0",
"uid": "4121ec0e-e815-11e9-a58e-00163e1274b8"
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "8Gi"
}
},
"storageClassName": "openebs-hostpath",
"volumeMode": "Filesystem",
"volumeName": "pvc-4121ec0e-e815-11e9-a58e-00163e1274b8"
},
"status": {
"accessModes": [
"ReadWriteOnce"
],
"capacity": {
"storage": "8Gi"
},
"phase": "Bound"
}
}
PV:
{
"apiVersion": "v1",
"kind": "PersistentVolume",
"metadata": {
"annotations": {
"pv.kubernetes.io/provisioned-by": "openebs.io/local"
},
"creationTimestamp": "2019-10-06T08:42:51Z",
"finalizers": [
"kubernetes.io/pv-protection"
],
"labels": {
"openebs.io/cas-type": "local-hostpath"
},
"name": "pvc-4121ec0e-e815-11e9-a58e-00163e1274b8",
"resourceVersion": "292897",
"selfLink": "/api/v1/persistentvolumes/pvc-4121ec0e-e815-11e9-a58e-00163e1274b8",
"uid": "48602c57-e815-11e9-a58e-00163e1274b8"
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"capacity": {
"storage": "8Gi"
},
"claimRef": {
"apiVersion": "v1",
"kind": "PersistentVolumeClaim",
"name": "data-consul-0",
"namespace": "consul",
"resourceVersion": "292839",
"uid": "4121ec0e-e815-11e9-a58e-00163e1274b8"
},
"local": {
"fsType": "",
"path": "/data/openebs/local/pvc-4121ec0e-e815-11e9-a58e-00163e1274b8"
},
"nodeAffinity": {
"required": {
"nodeSelectorTerms": [
{
"matchExpressions": [
{
"key": "kubernetes.io/hostname",
"operator": "In",
"values": [
"internal-k8s-master1"
]
}
]
}
]
}
},
"persistentVolumeReclaimPolicy": "Delete",
"storageClassName": "openebs-hostpath",
"volumeMode": "Filesystem"
},
"status": {
"phase": "Bound"
}
}
Expected Behavior
Mount successfully
Current Behavior
Got FailedMount error
Your Environment
kubectl get nodes
:
NAME STATUS ROLES AGE VERSION
internal-k8s-master1 Ready controlplane,etcd,worker 31h v1.14.6
internal-k8s-worker1 Ready etcd,worker 30h v1.14.6
kubectl get pods --all-namespaces
:
NAMESPACE NAME READY STATUS RESTARTS AGE
cattle-system cattle-cluster-agent-7f4c9bb7b8-6p68t 1/1 Running 5 31h
cattle-system cattle-node-agent-s8swz 1/1 Running 1 30h
cattle-system cattle-node-agent-x2jbh 1/1 Running 1 31h
cattle-system kube-api-auth-ccg2b 1/1 Running 1 31h
consul consul-0 0/1 ContainerCreating 0 17m
kube-system calico-node-6grt7 1/1 Running 1 30h
kube-system calico-node-gfrrp 1/1 Running 1 31h
kube-system coredns-autoscaler-5d5d49b8ff-jgwcn 1/1 Running 1 31h
kube-system coredns-bdffbc666-726zs 1/1 Running 3 31h
kube-system metrics-server-7f6bd4c888-mpf7b 1/1 Running 1 31h
kube-system rke-coredns-addon-deploy-job-q82bl 0/1 Completed 0 31h
kube-system rke-metrics-addon-deploy-job-98hvv 0/1 Completed 0 31h
kube-system rke-network-plugin-deploy-job-thcp8 0/1 Completed 0 31h
kube-system tiller-deploy-79b98967c5-wrkdw 1/1 Running 1 7h24m
kubeapps apprepo-sync-bitnami-1570353600-nbvq6 0/1 Completed 0 30m
kubeapps apprepo-sync-bitnami-1570354200-9jzd9 0/1 Completed 0 20m
kubeapps apprepo-sync-bitnami-1570354800-twxjt 0/1 Completed 0 10m
kubeapps apprepo-sync-bitnami-1570355400-jggsq 0/1 Completed 0 15s
kubeapps apprepo-sync-bitnami-hsprv-l7tpb 0/1 Completed 0 3h57m
kubeapps apprepo-sync-bitnami-lnq8s-6mp9r 0/1 Completed 0 26h
kubeapps apprepo-sync-incubator-1570354200-pm5h8 0/1 Completed 0 20m
kubeapps apprepo-sync-incubator-1570354800-p4wc9 0/1 Completed 0 10m
kubeapps apprepo-sync-incubator-1570355400-wdgng 0/1 Completed 0 15s
kubeapps apprepo-sync-incubator-k472m-cxldf 0/1 Completed 0 26h
kubeapps apprepo-sync-incubator-lvfd8-vtwpz 0/1 Completed 0 3h57m
kubeapps apprepo-sync-stable-1570353600-fjrzh 0/1 Completed 0 30m
kubeapps apprepo-sync-stable-1570354200-7rkn8 0/1 Completed 0 20m
kubeapps apprepo-sync-stable-1570354800-qch8j 0/1 Completed 0 10m
kubeapps apprepo-sync-stable-1570355400-lxrgc 1/1 Running 0 15s
kubeapps apprepo-sync-stable-2prw6-tl92t 0/1 Completed 0 3h57m
kubeapps apprepo-sync-stable-v4kr4-kz294 0/1 Completed 0 26h
kubeapps apprepo-sync-svc-cat-1570354200-9ccs4 0/1 Completed 0 20m
kubeapps apprepo-sync-svc-cat-1570354800-fkd7d 0/1 Completed 0 10m
kubeapps apprepo-sync-svc-cat-1570355400-sbhbk 0/1 Completed 0 15s
kubeapps apprepo-sync-svc-cat-hxszc-r5wvm 0/1 Completed 0 3h57m
kubeapps kubeapps-6bd9495c56-8bxdt 1/1 Running 3 26h
kubeapps kubeapps-6bd9495c56-mcx6g 1/1 Running 2 26h
kubeapps kubeapps-internal-apprepository-controller-55fcd5966-72ln8 1/1 Running 1 26h
kubeapps kubeapps-internal-chartsvc-7fc7bc4fc5-klzh4 1/1 Running 10 26h
kubeapps kubeapps-internal-chartsvc-7fc7bc4fc5-n729k 1/1 Running 2 26h
kubeapps kubeapps-internal-dashboard-5875d9f794-kgt2l 1/1 Running 1 26h
kubeapps kubeapps-internal-dashboard-5875d9f794-zqr9h 1/1 Running 1 26h
kubeapps kubeapps-internal-tiller-proxy-696ffcd799-76654 1/1 Running 3 26h
kubeapps kubeapps-internal-tiller-proxy-696ffcd799-fkqqv 1/1 Running 3 26h
kubeapps kubeapps-mongodb-6cbcc9ffd4-lg6m5 1/1 Running 1 26h
openebs openebs-admission-server-797586bf87-sgcpc 1/1 Running 1 29h
openebs openebs-apiserver-74bb8f8649-f22rs 1/1 Running 1 29h
openebs openebs-localpv-provisioner-7f9c88f575-rs865 1/1 Running 22 29h
openebs openebs-ndm-4d9l2 1/1 Running 1 29h
openebs openebs-ndm-operator-55cc69dc96-9p6s9 1/1 Running 2 29h
openebs openebs-ndm-skq2m 1/1 Running 1 29h
openebs openebs-provisioner-78b964ffb9-2wskm 1/1 Running 1 29h
openebs openebs-snapshot-operator-56c69dcb58-7z2vb 2/2 Running 3 29h
kubectl get sc
:
NAME PROVISIONER AGE
openebs-device openebs.io/local 29h
openebs-hostpath openebs.io/local 29h
openebs-jiva-default openebs.io/provisioner-iscsi 29h
openebs-jiva-disk-2repl (default) openebs.io/provisioner-iscsi 3h5m
openebs-snapshot-promoter volumesnapshot.external-storage.k8s.io/snapshot-promoter 29h
kubectl get pv
:
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-4121ec0e-e815-11e9-a58e-00163e1274b8 8Gi RWO Delete Bound consul/data-consul-0 openebs-hostpath 68m
kubectl get pvc
:
NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
consul data-consul-0 Bound pvc-4121ec0e-e815-11e9-a58e-00163e1274b8 8Gi RWO openebs-hostpath 69m
- OS (from
/etc/os-release
):
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
- Kernel (from
uname -a
):
Linux internal-k8s-master1 3.10.0-1062.1.2.el7.x86_64 #1 SMP Mon Sep 30 14:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Install tools:
Rancher
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
AmitKumarDas commentedon Oct 6, 2019
Cc @kmova
ranjithwingrider commentedon Oct 6, 2019
Can you check the prerequistes mentioned in the documentation?
https://docs.openebs.io/docs/next/prerequisites.html#rancher
NexZhu commentedon Oct 6, 2019
This fixed it for me, thanks!
BegoneRaven commentedon Sep 9, 2020
Just in case if anyone is wondering what path is to given in extra_binds, if you have a non default or custom host path like
/data/openebs/local for storage
This is what worked for me.
Both paths are supposed to be the same!
If you are using helm for openebs installation, ensure that .basepath is passed as an additional parameter
helm install --debug -n openebs openebs openebs/openebs --set localprovisioner.basePath="/data/openebs/local"
maxisam commentedon Feb 8, 2022
In my case, reboot fix it.
Rammurthy5 commentedon Apr 27, 2024
I have the same problem but on Talos Linux. Can i ask how to fix this, please?
letajmal commentedon Jun 19, 2024
For talos, modify worker.yaml
under
kubelet
then, apply these changes to all the worker nodes
ref: https://www.talos.dev/v1.7/kubernetes-guides/configuration/local-storage/
Mayastor Documentation in Talos site is now deprecated, it is only valid for mayastor version < 2.5. For later versions, refer: https://openebs.io/docs/quickstart-guide/installation