Permission denied error

Hi,
I’m using my local Kubernetes env (v1.19.3) and trying to deploy Haproxy with the yaml file below:

But it can not create pods’ status is “crashloopbackoff”.
And when I check the logs of the pod, it says permission denied error like below;

[root@server]# kubectl logs haproxy-ingress-67f7c8b555-qhr4p
2021/01/13 10:52:05
 _   _    _    ____
| | | |  / \  |  _ \ _ __ _____  ___   _
| |_| | / _ \ | |_) | '__/ _ \ \/ / | | |
|  _  |/ ___ \|  __/| | | (_) >  <| |_| |
|_| |_/_/   \_\_|   |_|  \___/_/\_\\__, |
 _  __     _                       |___/             ___ ____
| |/ /   _| |__   ___ _ __ _ __   ___| |_ ___  ___  |_ _/ ___|
| ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __|  | | |
| . \ |_| | |_) |  __/ |  | | | |  __/ ||  __/\__ \  | | |___
|_|\_\__,_|_.__/ \___|_|  |_| |_|\___|\__\___||___/ |___\____|


2021/01/13 10:52:05 HAProxy Ingress Controller v1.4.13 75fd943

2021/01/13 10:52:05 Build from: git@github.com:haproxytech/kubernetes-ingress.git
2021/01/13 10:52:05 Build date: 2021-01-07T10:41:15

2021/01/13 10:52:05 ConfigMap: haproxy-controller/haproxy
2021/01/13 10:52:05 Ingress class:
2021/01/13 10:52:05 Publish service:
2021/01/13 10:52:05 Default backend service: haproxy-controller/ingress-default-backend
2021/01/13 10:52:05 Default ssl certificate: haproxy-controller/
2021/01/13 10:52:05 Controller sync period: 5s
2021/01/13 10:52:05 PANIC   controller.go:241 mkdir /etc/haproxy/certs: permission denied

I tried to create manually /etc/haproxy/certs directory but didn’t worked.

How can I solve this problem? Thanks!

I had the same issue recently:
Change he security context of haproxy-ingress container

    securityContext:
      runAsUser:  0
      runAsGroup: 0