[英]Kuberenetes: receive CrashLoopBackOff
I can successfully run the following image on a local container. 我可以在本地容器上成功运行以下图像。
Dockerfile: Dockerfile:
FROM ubuntu:latest
RUN apt-get update
RUN apt-get -qq update
RUN apt-get install -y nodejs npm
# TODO could uninstall some build dependencies
# debian installs `node` as `nodejs`
RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
COPY package.json package.json
RUN npm install
COPY . .
CMD ["npm", "start"]
The current folder holds a simple "hello world" node-express app, and I can curl it to localhost:3000
. 当前文件夹包含一个简单的“ hello world” node-express应用程序,我可以将其卷曲到localhost:3000
。
The depolyment.yml: depolyment.yml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: node-deployment
labels:
app: node-app
spec:
replicas: 2
selector:
matchLabels:
app: node-app
template:
metadata:
labels:
app: node-app
spec:
containers:
- name: node-app
image: my-repo/ubuntu-node:firsttry
ports:
- containerPort: 3000
and the event ( kubectl describe pod
): 和事件( kubectl describe pod
):
Warning BackOff 40s (x20 over 5m) kubelet, minikube Back-off restarting failed container
Any suggestions about how to solve the issue? 有关如何解决此问题的任何建议?
Well, The pod was created and then crashed over and over again. 好吧,吊舱已创建,然后一遍又一遍地崩溃。 I discover that by running: 我发现通过运行:
kubctl logs node-deployment-57568f8f75-c2brt
And it was a nodemon problem: 这是一个nodemon问题:
[nodemon] watching: *.*
[nodemon] starting `node app.js`
Example app listening on port 3000!
[nodemon] Internal watch failed: watch /usr/lib/x86_64-linux-gnu/libanl.a ENOSPC
For now I just changed the CMD
in the Dockerfile to: 现在,我只是将Dockerfile中的CMD
更改为:
CMD ["node", "app.js"]
And now the pods are running. 现在,豆荚正在运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.