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
outputbash
2020/07/17 17:07:47_ _ _ ____ _____ _____| | | | / \ | _ \ _ __ _____ ___ _ | ____| ____|| |_| | / _ \ | |_) | '__/ _ \ \/ / | | | | _| | _|| _ |/ ___ \| __/| | | (_) > <| |_| | | |___| |___|_| |_/_/ \_\_| |_| \___/_/\_\\__, | |_____|_____|_ __ _ |___/ ___ ____| |/ / _| |__ ___ _ __ _ __ ___| |_ ___ ___ |_ _/ ___|| ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __| | | || . \ |_| | |_) | __/ | | | | | __/ || __/\__ \ | | |___|_|\_\__,_|_.__/ \___|_| |_| |_|\___|\__\___||___/ |___\____|2020/07/17 17:07:47 HAProxy Ingress Controller v1.4.5-ee1 c2b51562020/07/17 17:07:47 Build from: ssh://git@gitlab.int.haproxy.com/haproxy-controller/kubernetes-ingress-ee2020/07/17 17:07:47 Build date: 2020-07-12T00:00:53
outputbash
2020/07/17 17:07:47_ _ _ ____ _____ _____| | | | / \ | _ \ _ __ _____ ___ _ | ____| ____|| |_| | / _ \ | |_) | '__/ _ \ \/ / | | | | _| | _|| _ |/ ___ \| __/| | | (_) > <| |_| | | |___| |___|_| |_/_/ \_\_| |_| \___/_/\_\\__, | |_____|_____|_ __ _ |___/ ___ ____| |/ / _| |__ ___ _ __ _ __ ___| |_ ___ ___ |_ _/ ___|| ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __| | | || . \ |_| | |_) | __/ | | | | | __/ || __/\__ \ | | |___|_|\_\__,_|_.__/ \___|_| |_| |_|\___|\__\___||___/ |___\____|2020/07/17 17:07:47 HAProxy Ingress Controller v1.4.5-ee1 c2b51562020/07/17 17:07:47 Build from: ssh://git@gitlab.int.haproxy.com/haproxy-controller/kubernetes-ingress-ee2020/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
:
-
Get the name of the ConfigMap to edit by calling
kubectl get configmap --namespace haproxy-controller
. For example, the name might behaproxy-kubernetes-ingress
. -
Create a YAML file that contains a ConfigMap with the same name. Edit it to have the
syslog-server
key:example-configmap.yamlyamlapiVersion: v1kind: ConfigMapmetadata:name: haproxy-kubernetes-ingressnamespace: haproxy-controllerdata:syslog-server: "address:stdout, format: raw, facility:daemon"example-configmap.yamlyamlapiVersion: v1kind: ConfigMapmetadata:name: haproxy-kubernetes-ingressnamespace: haproxy-controllerdata:syslog-server: "address:stdout, format: raw, facility:daemon" -
Apply the change with
kubectl apply
:bashkubectl apply -f example-configmap.yamlbashkubectl apply -f example-configmap.yamlYou will then see access logs when you call
kubectl logs
:bash10.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"bash10.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.