Я пытался перейти по этой ссылке о Kubernetes MongoDB с постоянным томом (точно таким же).
, но после того, как я развернул все и посмотрел на модуль, я получил эти ошибки:
Name: mongodb-standalone-0
Namespace: default
Priority: 0
Node: <none>
Labels: app=database
controller-revision-hash=mongodb-standalone-7688499856
selector=mongodb-standalone
statefulset.kubernetes.io/pod-name=mongodb-standalone-0
Annotations: <none>
Status: Pending
IP:
IPs: <none>
Controlled By: StatefulSet/mongodb-standalone
Containers:
mongodb-standalone:
Image: mongo:4.0.8
Port: <none>
Host Port: <none>
Environment:
MONGO_INITDB_ROOT_USERNAME_FILE: /etc/k8-training/admin/MONGO_ROOT_USERNAME
MONGO_INITDB_ROOT_PASSWORD_FILE: /etc/k8-training/admin/MONGO_ROOT_PASSWORD
Mounts:
/config from mongodb-conf (ro)
/data/db from mongodb-data (rw)
/docker-entrypoint-initdb.d from mongodb-scripts (ro)
/etc/k8-training from k8-training (ro)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-xbl5z (ro)
Conditions:
Type Status
PodScheduled False
Volumes:
k8-training:
Type: Secret (a volume populated by a Secret)
SecretName: k8-training
Optional: false
mongodb-scripts:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: mongodb-standalone
Optional: false
mongodb-conf:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: mongodb-standalone
Optional: false
mongodb-data:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: mongodb-standalone
ReadOnly: false
default-token-xbl5z:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-xbl5z
Optional: false
QoS Class: BestEffort
Node-Selectors: kubernetes.io/hostname=mongodb-node
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling <unknown> default-scheduler 0/1 nodes are available: 1 node(s) didn't match node selector.
Warning FailedScheduling <unknown> default-scheduler 0/1 nodes are available: 1 node(s) didn't match node selector.
Результат kubectl get nodes --show-labels
:
minikube Ready master 43h v1.17.0 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=minikube,kubernetes.io/os=linux,node-role.kubernetes.io/master=
Я пытался найти способ отладки этой проблемы, ничего не получил ..
Я успешно запускаю моя MongoDB с моими приложениями в Kubernetes, но проблема в том, что я хочу иметь постоянный объем для своих данных, и до сих пор я не мог найти правильный подход, чтобы заставить это работать. Я благодарен за любую помощь, спасибо.
ОБНОВЛЕНИЕ
Я следовал, чтобы изменить nodeSelector, но все еще получил ту же ошибку:
Name: mongodb-standalone-0
Namespace: default
Priority: 0
Node: <none>
Labels: app=database
controller-revision-hash=mongodb-standalone-74895d955f
selector=mongodb-standalone
statefulset.kubernetes.io/pod-name=mongodb-standalone-0
Annotations: <none>
Status: Pending
IP:
IPs: <none>
Controlled By: StatefulSet/mongodb-standalone
Containers:
mongodb-standalone:
Image: mongo:4.0.8
Port: <none>
Host Port: <none>
Environment:
MONGO_INITDB_ROOT_USERNAME_FILE: /etc/k8-training/admin/MONGO_ROOT_USERNAME
MONGO_INITDB_ROOT_PASSWORD_FILE: /etc/k8-training/admin/MONGO_ROOT_PASSWORD
Mounts:
/config from mongodb-conf (ro)
/data/db from mongodb-data (rw)
/docker-entrypoint-initdb.d from mongodb-scripts (ro)
/etc/k8-training from k8-training (ro)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-xbl5z (ro)
Conditions:
Type Status
PodScheduled False
Volumes:
k8-training:
Type: Secret (a volume populated by a Secret)
SecretName: k8-training
Optional: false
mongodb-scripts:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: mongodb-standalone
Optional: false
mongodb-conf:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: mongodb-standalone
Optional: false
mongodb-data:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: mongodb-standalone
ReadOnly: false
default-token-xbl5z:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-xbl5z
Optional: false
QoS Class: BestEffort
Node-Selectors: kubernetes.io/hostname=minikube
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling <unknown> default-scheduler 0/1 nodes are available: 1 node(s) didn't find available persistent volumes to bind.
Warning FailedScheduling <unknown> default-scheduler 0/1 nodes are available: 1 node(s) didn't find available persistent volumes to bind.