I am running a 5 nodes Kubernetes cluster. I'm trying to run a (on nginx based) container.
The dockerfile is straight forward:
FROM nginx
COPY src/ /usr/share/nginx/html
the html is in the src
folder. When I try to run it with Docker everything is fine. I now try to run it in Kubernetes with this yaml:
---
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: And in the logs of Docker this arises:
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. to add RUN chmod 777 /var/cache/nginx -R
to the 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