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:

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

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

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

    nix
    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"
    nix
    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"

Do you have any suggestions on how we can improve the content of this page?