[英]Kubernetes running nginx doesn't start
I am running a 5 nodes Kubernetes cluster. 我正在运行5节点Kubernetes集群。 I'm trying to run a (on nginx based) container.
我正在尝试运行一个(基于nginx的)容器。
The dockerfile is straight forward: dockerfile很简单:
FROM nginx
COPY src/ /usr/share/nginx/html
the html is in the src
folder. html位于
src
文件夹中。 When I try to run it with Docker everything is fine. 当我尝试使用Docker运行它时一切都很好。 I now try to run it in Kubernetes with this yaml:
我现在尝试用这个yaml在Kubernetes中运行它:
---
apiVersion: v1
kind: Namespace
metadata:
name: three-tier
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: front-end
namespace: three-tier
spec:
replicas: 1
template:
metadata:
labels:
name: front-end
spec:
containers:
- name: front-end
image: xanvier/angularfrontend #TBD
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 8079
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
readOnlyRootFilesystem: true
---
apiVersion: v1
kind: Service
metadata:
name: front-end
labels:
name: front-end
namespace: three-tier
spec:
type: NodePort
ports:
- port: 80
targetPort: 8079 #nodePort: 30001
selector:
name: front-end
---
In the ui I get this error message: 在ui中我收到此错误消息:
And in the logs of Docker this arises:
在Docker的日志中出现了这样的情况:
I thought I did something very simple, so I probably looking straight at it but can't see the problem. 我以为我做了一件非常简单的事情,所以我可能会直视它但却看不出问题。
I alse tried to give the folder /var/cache/nginx
777 rights. 我也尝试给文件夹
/var/cache/nginx
777权限。 to add RUN chmod 777 /var/cache/nginx -R
to the dockerfile. 将
RUN chmod 777 /var/cache/nginx -R
到dockerfile。 Also I tried to disable caching to add a new config file which disables caching altogether. 此外,我试图禁用缓存添加一个新的配置文件,完全禁用缓存。 Both didn't solve the problem.
两者都没有解决问题。
Well this is awkward... 嗯,这是尴尬...
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
readOnlyRootFilesystem: true
Removed those lines and worked like a charm 删除那些线条,像一个魅力
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.