Metrics-server: Error: container has runAsNonRoot and image will run as root

Created on 31 Oct 2019  路  13Comments  路  Source: kubernetes-sigs/metrics-server

Greetings,

With yesterday's addition in the deployment file:

        securityContext:
          readOnlyRootFilesystem: true
          runAsNonRoot: true

I get this error while pod is initializing
Error: container has runAsNonRoot and image will run as root

I am using EKS 1.14.6 - Fresh new cluster

When I remove the block above, everything runs fine.

Most helpful comment

All 13 comments

Same here

I'm using k3s, Kubernetes v1.16.2

/assign

+1 k8s, Kubernetes v1.16.2

this is related to #152

to avoid this problem i deploy from latest release, not master branch ...

The issue is related to missing runAsUser. I tested with it and it works on kind and EKS 1.14.6.

I can send a new PR for the fix.

to avoid this problem i deploy from latest release, not master branch ...

Yes, that helped. This should be part of the documentation.

$ git clone https://github.com/kubernetes-incubator/metrics-server.git
$ cd metrics-server
$ git checkout v0.3.6
$ kubectl create -f deploy/1.8+/

Unfortunately, metrics server ist started now but does not get metrics.

Is there any updates on this problem ?

@serathius i still got the error in the logs E1107 13:30:35.383039 1 manager.go:111] unable to fully collect metrics: unable to fully scrape metrics from source kubelet_summary:k8s-master: unable to fetch metrics from Kubelet

@udit0612 this issue is about not running container as root. Your error looks like problem with mismatch of your cluster and metrics server configuration.

Please look if there is other issue that describes similar problem. I also would be open to help you configure it on k8s slack in #sig-instrumentation channel

I am also getting the same issue.But in my case infra is handled by infra team and they make it mandatory to make images as non root user.I am stuck there as i am not sure how i can make my angular app using non root user.Here is my docker file :

FROM docker.com/node:latest as node
WORKDIR /app

COPY . .
RUN npm install

RUN npm build --prod

RUN npm run ng build -- --prod

stage 2 : to run application

FROM docker.com/nginx:alpine
COPY --from=node /app/dist/MyApp /usr/share/nginx/html

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GregSilverman picture GregSilverman  路  4Comments

serathius picture serathius  路  9Comments

system-dev-formations picture system-dev-formations  路  8Comments

bianchi2 picture bianchi2  路  6Comments

shiveshabhishek picture shiveshabhishek  路  8Comments