Hi! I am experiencing issues in deploying Elastics...
# all-things-deployment
s
Hi! I am experiencing issues in deploying Elasticsearch cluster from datahub-helm prerequisites as pod security constraints complain about root access for
configure-sysctl
initcontainer pod. I see running sysctl command requires root access but the container constraints does not allow that. Attached is my StatefulSet that results in this error. How can I fix this?
Copy code
Event  : elasticsearch-master   StatefulSet   elasticsearch-master   datahub     create Pod elasticsearch-master-0 in StatefulSet elasticsearch-master failed error: admission webhook "<http://pod-security-webhook.kubernetes.io|pod-security-webhook.kubernetes.io>" denied the request: pods "elasticsearch-master-0" is forbidden: violates PodSecurity "restricted:latest": privileged (container "configure-sysctl" must not set securityContext.privileged=true), allowPrivilegeEscalation != false (container "configure-sysctl" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "configure-sysctl" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "configure-sysctl" must set securityContext.runAsNonRoot=true), runAsUser=0 (container "configure-sysctl" must not set runAsUser=0), seccompProfile (pod or container "configure-sysctl" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")   FailedCreate
plus1 1
o
Hi! What version of Kubernetes are you trying to deploy with? We've tested with up to v1.22 and it seems like there were some PodSecurity updates in more recent versions
s
Hi! I am running on 1.24.3
Probably here is something relevant: https://github.com/elastic/helm-charts/issues/1126
Any thoughts on this problem @bumpy-needle-3184?
b
below is the issue in elastic helm chart repository, you can follow the suggestion mentioned there https://github.com/elastic/helm-charts/issues/689 or you can deploy it in k8s v1.22 , where it is working fine
s
Thanks for the reply Navin. I tried that but still there is no way to get around with root access which is required to increase the virtual memory. Then I’m left with going back to k8s 1.22
b
was it failing after setting below in values.yaml under elasticsearch key
Copy code
sysctlInitContainer:
  enabled: false
s
After setting this would leave container with default vm size 65535 which is not enough to run at least the single node server
b
ok
s
So I tried extraInitContainers option without
runAsUser: 0
but obviously that couldn’t run sysctl either
b
i am not sure if it will work , could you try with below option
Copy code
securityContext:
          allowPrivilegeEscalation: true
s
It wont work on k8s 1.24 as it has podSecurityPolicy restricted which means always allowPrivilegeEscalation: false
any thoughts @orange-night-91387?
w
@shy-dog-84302 - We are running into same issue. Were you able to find any solution regarding the init container running as root?
s
@white-appointment-14217 No we could not fix this problem but resorted to a managed OpenSearch service where we can skip setting up ES infrastructure ourselves.