4

working with rancher below types of issue comes ---please help me for exacted code App: influxdb2Installing Failed to install app influxdb2. Error: failed post-install: job failed: DeadlineExceeded

CreateContainerConfigError: container has runAsNonRoot and image will run as root

Regards Praveen

Praveen
  • 41
  • 1
  • 2
  • Seems https://stackoverflow.com/questions/49720308/kubernetes-podsecuritypolicy-set-to-runasnonroot-container-has-runasnonroot-and can help you – FakeAlcohol Sep 21 '20 at 08:54
  • Does the above solve your problem? – Wytrzymały Wiktor Sep 22 '20 at 11:14
  • Does this answer your question? [kubernetes PodSecurityPolicy set to runAsNonRoot, container has runAsNonRoot and image has non-numeric user (appuser), cannot verify user is non-root](https://stackoverflow.com/questions/49720308/kubernetes-podsecuritypolicy-set-to-runasnonroot-container-has-runasnonroot-and) – The Fool Jul 25 '23 at 19:47

1 Answers1

0

Add to the pod definition:

securityContext:
  runAsNonRoot: true
  runAsUser: 1000

Also check this answer for more details:
Kubernetes runAsNonRoot failing: CreateContainerConfigError

Alter
  • 903
  • 1
  • 11
  • 27
  • that's exactly what is causing the issue. You need to add `runAsUser` and as bonus `runAsGroup` to the `securityContext`. Or even better create a user in your container and use its uid as `USER` instruction, that way kubernetes is able to see its a non root user. – The Fool Jul 24 '23 at 18:27
  • Yeah, this was missing: `runAsUser: 1000` – Alter Jul 25 '23 at 15:12