HAProxy Kubernetes Ingress Controller Documentation 1.10

How to troubleshoot

Several techniques exist for diagnosing problems with the ingress controller. They include viewing logs, viewing pod details, and logging into the pod to check files.

View the logs

  1. Get the names of the haproxy-kubernetes-ingress pods:

    $ kubectl get pods --namespace haproxy-controller
    
      NAME                                 READY   STATUS    RESTARTS   AGE
      haproxy-kubernetes-ingress-7d84545b45-fpzm9  1/1     Running   0          3m49s
      haproxy-kubernetes-ingress-7d84545b45-wq426  1/1     Running   0          3m49s
  2. Use kubectl logs to view the logs of a pod:

    $ kubectl logs haproxy-kubernetes-ingress-7d84545b45-fpzm9
    
      2020/07/17 17:07:47
      _   _    _    ____                        _____ _____
      | | | |  / \  |  _ \ _ __ _____  ___   _  | ____| ____|
      | |_| | / _ \ | |_) | '__/ _ \ \/ / | | | |  _| |  _|
      |  _  |/ ___ \|  __/| | | (_) >  <| |_| | | |___| |___
      |_| |_/_/   \_\_|   |_|  \___/_/\_\\__, | |_____|_____|
      _  __     _                       |___/             ___ ____
      | |/ /   _| |__   ___ _ __ _ __   ___| |_ ___  ___  |_ _/ ___|
      | ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __|  | | |
      | . \ |_| | |_) |  __/ |  | | | |  __/ ||  __/\__ \  | | |___
      |_|\_\__,_|_.__/ \___|_|  |_| |_|\___|\__\___||___/ |___\____|
    
    
      2020/07/17 17:07:47 HAProxy Ingress Controller v1.4.5-ee1 c2b5156
    
      2020/07/17 17:07:47 Build from: ssh://git@gitlab.int.haproxy.com/haproxy-controller/kubernetes-ingress-ee
      2020/07/17 17:07:47 Build date: 2020-07-12T00:00:53
    
      2020/07/17 17:07:47 ConfigMap: default/kubernetes-ingress
      2020/07/17 17:07:47 Ingress class:
      2020/07/17 17:07:47 Publish service:
      2020/07/17 17:07:47 Default backend service: default/haproxy-kubernetes-ingress-default-backend
      2020/07/17 17:07:47 Default ssl certificate: default/haproxy-kubernetes-ingress-default-cert
      2020/07/17 17:07:47 Controller sync period: 5s
      2020/07/17 17:07:47 controller.go:262 Running with HA-Proxy version 2.1.0-1.0.0-223.185 2020/06/18 - https://haproxy.org/
      2020/07/17 17:07:47 INFO    controller.go:267 Starting HAProxy with /etc/haproxy/haproxy.cfg
      2020/07/17 17:07:47 INFO    controller.go:272 Running on haproxy-kubernetes-ingress-7d84545b45-fpzm9
      [NOTICE] 198/170747 (21) : New worker #1 (22) forked
      2020/07/17 17:07:48 INFO    controller.go:95 Running on Kubernetes version: v1.18.3 linux/amd64
      2020/07/17 17:07:48 INFO    monitor.go:35 executing syncPeriod every 5s
      2020/07/17 17:07:54 INFO    controller.go:220 HAProxy reloaded
  3. For debug logs, upgrade the ingress controller with the log argument set to debug.

    $ helm upgrade haproxy-kubernetes-ingress haproxytech/kubernetes-ingress \
      --namespace haproxy-controller \
      --set controller.logging.level=debug 
  4. By default, the ingress controller’s logs do not include traffic logs, but you can enable them by setting the syslog-server option to stdout.

View pod details

  1. View the details of the ingress controller pod by using kubectl describe pod:

    $ kubectl describe pod haproxy-kubernetes-ingress-7d84545b45-fpzm9
    
      Name:         haproxy-kubernetes-ingress-7d84545b45-fpzm9
      Namespace:    haproxy-controller
      Priority:     0
      Node:         minikube/192.168.99.116
      Start Time:   Fri, 17 Jul 2020 13:06:37 -0400
      Labels:       app.kubernetes.io/instance=kubernetes-ingress
                    app.kubernetes.io/name=kubernetes-ingress
                    pod-template-hash=7d84545b45
  2. You can also view the YAML that was used to deploy the ingress controller by using kubectl get deployment:

    $ kubectl get deployment haproxy-kubernetes-ingress -o yaml --namespace haproxy-controller
    
      apiVersion: apps/v1
      kind: Deployment
      metadata:
      annotations:
        deployment.kubernetes.io/revision: "1"
      creationTimestamp: "2020-07-17T17:06:37Z"
      generation: 1
      labels:
        app.kubernetes.io/instance: kubernetes-ingress
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/name: kubernetes-ingress
        app.kubernetes.io/version: 1.4.5
        helm.sh/chart: kubernetes-ingress-1.4.2

Log into the pod

  1. Use kubectl exec to log into the ingress controller pod to inspect the HAProxy files:

    $ kubectl exec -it haproxy-kubernetes-ingress-7d84545b45-fpzm9 /bin/bash
    $ cd /etc/haproxy
    $ ls
      certs  haproxy.cfg  maps  modsec