It seems that the Google Monitoring Agent (powered by Stackdriver) should be installed on each Node (i.e. each compute instance, i.e. each machine) of a Kubernetes cluster.
However the new plugins, like Nginx, Redis, ElasticSearch..., need those agents to know the IP of these services. This means having kube-proxy
running and set up which should mean running that Google Monitoring Agent on a Pod.
These two conflict: On one side that agent monitors the entire machine, on the other it monitor services running on one or more machines.
Can these Stackdriver plugins work on a Google Container Engine (GKE) / Kubernetes cluster?
I had tried to use a Stackdriver container in a pod to collect stats about Nginx/Uwsgi in the same pod. I had some findings that may be not so helpful. Just for your reference.
To create the stackdriver image, you may reference the docker file created by Keto. https://hub.docker.com/r/keto/stackdriver/~/dockerfile/
The run.sh is look like below,
In the GKE/K8S deployment yaml file,
In my test, I found
Well, I hope to find some way to collect both statistics of the pods and nodes that I need, but I didn't find a easy way to do that. What I did is do that by Google Python API library, but that takes too much time.
You can install the StackDriver Agent in your Dockerfile.
I have been able to get this working for a couchdb container as follows:
There is an other way to use Dockerfile. When creating the docker image, pre-install necessary libraries for the stackdriver-agent installation.
Then install the agent using POD lifecycle.
To monitor each machine (memory, CPU, disk...) it's possible to install the agent on each node (i.e. on each Compute Instance of your GKE cluster). Note that it'll not work with auto-scaling in the sense that re-created nodes won't have the agent installed.
To monitor services (number of requests/s, client connection...) it's possible to install the agent plugin in another container so that for example Nginx Pod run two containers:
Note: Not fully tested yet.