Remove namespace on “Terminating”

When removing Namespaces are waiting for (already) deleted pods or deployments, there is something wrong…
But if you do not want to wait until the waiting is over, you can terminate the pod/deployment manually:

Run on the admin node:

NS=kubectl get ns |grep Terminating | awk 'NR==1 {print $1}' && kubectl get namespace "$NS" -o json | tr -d "\n" | sed "s/\"finalizers\": [[^]]+]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/$NS/finalize -f -

Use of course at your own risk!

Send HAProxy logs to remote host

I Wanted to send my HAProxy logging to a remote server so my loadbalancer didn’t have to deal with logging.

In the haproxy.conf I changed this line:

global
       log 127.0.0.1 local0

To this:

global
        log 10.0.6.15 local0

All logging for HAProxy is now send to my logging server after a restart/reload of HAProxy.

This is how my logging server receives the logs send from HAProxy:

Mar 10 12:02:05 lb01 haproxy[27980]: <ip>:47970 [10/Mar/2016:12:02:05.645] http-proxy httpweb02/web02 0/0/0/1/1 200 441 - - ---- 3/1/0/0/0 0/0 "GET /server-status?auto HTTP/1.1"

I Want to remove these lines from the default syslog file on my logging server and send to a seperate file.

On the logging server, create the following file:

/etc/rsyslog.d/haproxy.conf

With the following content:

# HAProxy logging
:syslogtag, startswith, "haproxy" /data/log/haproxy/haproxy.log
& ~

This tells the rsyslog daemon to filter all messages starting with “haproxy” from the syslog tag and send it to my custom logging location: /data/log/haproxy/haproxy.log

The “& ~” line is not to log it to any default location like messages or syslog files.

Restart the rsyslog daemon on the logging server to activate this rsyslog filter.