Administration

Enable logging

The ingress controller provides two types of logs:

  • the ingress controller’s process logs
  • traffic access logs

View process logs Jump to heading

When you install the Kubernetes Ingress Controller, it captures logs from the controller itself. Use kubectl logs to view the logs of the ingress controller pod:

bash
kubectl logs haproxy-kubernetes-ingress-7d84545b45-fpzm9 --namespace haproxy-controller
bash
kubectl logs haproxy-kubernetes-ingress-7d84545b45-fpzm9 --namespace haproxy-controller
output
bash
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
output
bash
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

View access logs Jump to heading

By default, process logs will not include access logs from requests and responses. To see access logs when you call kubectl logs:

  1. Get the name of the ConfigMap to edit by calling kubectl get configmap --namespace haproxy-controller. For example, the name might be haproxy-kubernetes-ingress.

  2. Create a YAML file that contains a ConfigMap with the same name. Edit it to have the syslog-server key:

    example-configmap.yaml
    yaml
    apiVersion: v1
    kind: ConfigMap
    metadata:
    name: haproxy-kubernetes-ingress
    namespace: haproxy-controller
    data:
    syslog-server: "address:stdout, format: raw, facility:daemon"
    example-configmap.yaml
    yaml
    apiVersion: v1
    kind: ConfigMap
    metadata:
    name: haproxy-kubernetes-ingress
    namespace: haproxy-controller
    data:
    syslog-server: "address:stdout, format: raw, facility:daemon"
  3. Apply the change with kubectl apply:

    bash
    kubectl apply -f example-configmap.yaml
    bash
    kubectl apply -f example-configmap.yaml

    You will then see access logs when you call kubectl logs:

    bash
    10.244.0.1:48817 [29/Sep/2020:20:34:48.208] http default-app-service-80/SRV_ZYWuA 0/0/0/1/1 200 504 - - ---- 4/2/0/0/0 0/0 "GET test.local/app HTTP/1.1"
    10.244.0.1:48817 [29/Sep/2020:20:34:49.761] http default-app-service-80/SRV_ZYWuA 0/0/0/0/0 200 504 - - ---- 4/2/0/0/0 0/0 "GET test.local/app HTTP/1.1"
    10.244.0.1:48817 [29/Sep/2020:20:34:50.787] http default-app-service-80/SRV_ZYWuA 0/0/0/0/0 200 504 - - ---- 4/2/0/0/0 0/0 "GET test.local/app HTTP/1.1"
    bash
    10.244.0.1:48817 [29/Sep/2020:20:34:48.208] http default-app-service-80/SRV_ZYWuA 0/0/0/1/1 200 504 - - ---- 4/2/0/0/0 0/0 "GET test.local/app HTTP/1.1"
    10.244.0.1:48817 [29/Sep/2020:20:34:49.761] http default-app-service-80/SRV_ZYWuA 0/0/0/0/0 200 504 - - ---- 4/2/0/0/0 0/0 "GET test.local/app HTTP/1.1"
    10.244.0.1:48817 [29/Sep/2020:20:34:50.787] http default-app-service-80/SRV_ZYWuA 0/0/0/0/0 200 504 - - ---- 4/2/0/0/0 0/0 "GET test.local/app HTTP/1.1"

If this page was useful, please, Leave the feedback.

© 2023 HAProxy Technologies, LLC. All Rights Reserved
Manage Cookie Preferences