在我向部署添加args(下面添加)之前,此部署很好。我无法弄清楚为什么在添加简单的args时它会变成CrashLoopError。我甚至试图回应Hello World,它仍会导致CrashLoopError。
没有日志,当我描述它显示的pod时:
Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "nginx" with CrashLoopBackOff: "Back-off 10s restarting failed container=nginx pod=nginx-2247906467-r9znh_dave-testing(98c3999e-c39b-11e6-936e-0050568b4a68)"
这是YAML:
- kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: nginx
spec:
replicas: 1
template:
metadata:
labels:
name: nginx
version: "1.9"
spec:
containers:
- name: nginx
imagePullPolicy: Always
image: "nginx:1.9"
ports:
- containerPort: 80
args:
- "echo $NGINX_CONF > /etc/nginx/nginx.conf"
env:
- name: NGINX_CONF
valueFrom:
secretKeyRef:
name: confs
key: nginx
答案 0 :(得分:1)
这是Kubernetes Pod的工作版本,带有nginx alpine docker图像:
apiVersion: v1
kind: Pod
metadata:
name: frontend-nginx-pod
labels:
app: nginx-test
spec:
containers:
- name: nginx
image: nginx:1.11.6-alpine
ports:
- containerPort: 80
name: "http-server"
args:
- /bin/sh
- -c
- echo "hello" > /usr/share/nginx/html/index.html && nginx "-g daemon off;"
如上所述我没有列出args
,我收到同样的错误。