2 posts tagged

monitoring

In order command

kubectl top node

to work you need to deploy Metrics Server, which it easy task.

DOWNLOAD_URL=$(curl -Ls "https://api.github.com/repos/kubernetes-sigs/metrics-server/releases/latest" | jq -r .tarball_url)
DOWNLOAD_VERSION=$(grep -o '[^/v]*$' <<< $DOWNLOAD_URL)
curl -Ls $DOWNLOAD_URL -o metrics-server-$DOWNLOAD_VERSION.tar.gz
mkdir metrics-server-$DOWNLOAD_VERSION
tar -xzf metrics-server-$DOWNLOAD_VERSION.tar.gz --directory metrics-server-$DOWNLOAD_VERSION --strip-components 1
kubectl apply -f metrics-server-$DOWNLOAD_VERSION/deploy/1.8+/

in some time you can execute the command

kubectl top node

and see something similar to this

kubernetesmonitoring

Here is simple systemd unit for coreos docker monitoring in zabbix.

Put this in /etc/systemd/system/zabbix-agent.service

[Unit]
Description=Zabbix agent
After=docker.service
Requires=docker.service

[Service]
ExecStartPre=-/usr/bin/docker kill zabbix-agent-xxl
ExecStartPre=-/usr/bin/docker rm zabbix-agent-xxl
ExecStart=/usr/bin/docker run  --name=zabbix-agent-xxl -p 10050:10050  -v /:/rootfs  -v /var/run:/var/run -e "ZA_Server=yourzabbix.server.com"  monitoringartist/zabbix-agent-xxl-limited:latest
ExecStop=/usr/bin/docker stop zabbix-agent-xxl

And launch with

systemctl enable zabbix-agent
systemctl start zabbix-agent

Inspect running container with

docker ps

, it should be running.

Please note, that every time zabbix container could not be started, it should be recreated.