Raj*_*ain 5 mongodb kubernetes google-kubernetes-engine kubernetes-helm
我正在尝试运行 mongodb 的 helm 图表,但遇到了就绪/活跃度探测问题。稳定存储库中的 Mongodb Helm Chart 将安装 Pod 和服务。但吊舱因就绪探测而崩溃。我可以尝试删除它们,但我想知道为什么会发生这种情况。
helm install --name mongodb stable/mongodb
kubectl describe pod mongodb-5ff464b5b9-nnz5x
Containers:
mongodb:
Container ID: docker://055f12c14992dc111ee8f0baff7faceafae6a16e518b27a174a7997408235afa
Image: docker.io/bitnami/mongodb:4.0.2-debian-9
Image ID: docker-pullable://bitnami/mongodb@sha256:6c050bf9063976e12aabb7bafcc7b2616df1e1dbbf19ac41b4799826abec92a3
Port: 27017/TCP
Host Port: 0/TCP
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Error
Exit Code: 137
Started: Thu, 27 Sep 2018 17:54:01 -0400
Finished: Thu, 27 Sep 2018 17:55:50 -0400
Ready: False
Restart Count: 6
Liveness: exec [mongo --eval db.adminCommand('ping')] delay=30s timeout=5s period=10s #success=1 #failure=6
Readiness: exec [mongo --eval db.adminCommand('ping')] delay=5s timeout=5s period=10s #success=1 #failure=6
Environment:
MONGODB_ROOT_PASSWORD: <set to the key 'mongodb-root-password' in secret 'mongodb'> Optional: false
MONGODB_USERNAME:
MONGODB_DATABASE:
MONGODB_ENABLE_IPV6: yes
MONGODB_EXTRA_FLAGS:
Mounts:
/bitnami/mongodb from data (rw)
Run Code Online (Sandbox Code Playgroud)
在错误部分,我看到以下内容。我需要做什么才能打开集装箱港口吗?
connecting to: mongodb://127.0.0.1:27017
2018-09-27T21:43:04.664+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed
Warning Unhealthy 6m kubelet, vm-b768f1df-3df6-4a79-50e5-9af633c6d9b9 Readiness probe failed: MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017
2018-09-27T21:43:14.670+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed
Warning Unhealthy 6m kubelet, vm-b768f1df-3df6-4a79-50e5-9af633c6d9b9 Readiness probe failed: MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017
2018-09-27T21:43:24.657+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed
Run Code Online (Sandbox Code Playgroud)
来自 Pod 的日志我检查了日志,没有什么值得注意的
`kubectl logs mongodb-5ff464b5b9-nnz5x -p`
------
Welcome to the Bitnami mongodb container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mongodb
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mongodb/issues
nami INFO Initializing mongodb
mongodb INFO ==> Deploying MongoDB from scratch...
mongodb INFO ==> No injected configuration files found. Creating default config files...
Run Code Online (Sandbox Code Playgroud)
在 GKE 上运行相同的 Helm Chart,我遇到了完全相同的问题
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 1m (x4 over 1m) default-scheduler PersistentVolumeClaim is not bound: "mongodb-bitnami" (repeated 3 times)
Normal Scheduled 1m default-scheduler Successfully assigned mongodb-bitnami-7b65895fd7-xr6gg to gke-cluster-default-pool-bec82955-xmhz
Normal SuccessfulMountVolume 1m kubelet, gke-cluster-default-pool-bec82955-xmhz MountVolume.SetUp succeeded for volume "default-token-whl5w"
Normal SuccessfulMountVolume 1m kubelet, gke-cluster-default-pool-bec82955-xmhz MountVolume.SetUp succeeded for volume "pvc-ddda94dd-c2c1-11e8-b2f0-42010af00119"
Normal Pulling 1m kubelet, gke-cluster-default-pool-bec82955-xmhz pulling image "docker.io/bitnami/mongodb:4.0.2-debian-9"
Normal Pulled 39s kubelet, gke-cluster-default-pool-bec82955-xmhz Successfully pulled image "docker.io/bitnami/mongodb:4.0.2-debian-9"
Normal Created 38s kubelet, gke-cluster-default-pool-bec82955-xmhz Created container
Normal Started 37s kubelet, gke-cluster-default-pool-bec82955-xmhz Started container
Warning Unhealthy 28s kubelet, gke-cluster-default-pool-bec82955-xmhz Readiness probe failed: MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017
2018-09-28T01:58:44.936+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed
Warning Unhealthy 20s kubelet, gke-cluster-default-pool-bec82955-xmhz Readiness probe failed: MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017
2018-09-28T01:58:52.114+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed
Run Code Online (Sandbox Code Playgroud)
它与端口是否打开无关,看起来更像是 mongo 本身崩溃并且就绪探针失败。
您可以通过查看日志找到更多见解:
kubectl logs <pod-crashing-name> (-c <container-name-optionally)
Run Code Online (Sandbox Code Playgroud)
您还可以 ssh 进入运行 pod 的节点并获取 docker 日志
docker ps -a | grep mongo
docker logs <container-id-that-crashed>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7851 次 |
| 最近记录: |