Haproxy frontend issue

Hi guys,

iam facing the same issue i.e. my frontend haproxy in kubernetes is going in a crashloopbackoff please help, here is my frontend code:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: haproxy-ingress-devops
  namespace: haproxy-controller-devops
  labels:
    run: haproxy-ingress
spec:
  replicas: 1
  selector:
    matchLabels:
      run: haproxy-ingress
  template:
    metadata:
      labels:
        run: haproxy-ingress
    spec:
      serviceAccountName: haproxy-service-account-devops
      containers:
      - name: ingress-container-devops
        image: haproxytech/kubernetes-ingress
        resources:
          requests:
            memory: "50Mi"
            cpu: "500m"
        command: ["/bin/sh"]
        args: ["-c","--default-backend-service=haproxy-controller-devops/service-backend-devops"]
        livenessProbe:
          httpGet:
            path: /healthz
            port: 1024
        ports:
        - name: http
          containerPort: 80
        - name: https
          containerPort: 443
        - name: stat
          containerPort: 1024
        env:
        - name: TZ
          value: Etc/UTC
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace

Please also see attached file:


I see that your  frontend Code is correct , but the following line(s)  could be the issue:
command: ["/bin/sh"]
args: ["-c","--default-backend-service=haproxy-controller-devops/service-backend-devops"]

it should be replaced with:

      args:
      - --default-backend-service=haproxy-controller-devops/service-backend-devops
  

Hi faisal,

You can check this  link also:

https://kodekloud.com/community/t/pod-crashing-on-kubernetes-deployment/14855

To fix the issue the reviewer suggested to use "args " only without "command"
and it works !

Good Luck !

Thanks for your suggestion, it worked.

1 Like

hi @faisalbasha1982, seems like you have completed the task.