StackDriver logging and Monitoring with GKE
Google Container Engine (GKE) recently (like in the past 48 hours) changed itโs name to Google Kubernetes Engine, which just makes more sense. Anyways, I needed to enable monitoring and logging on my GKE cluster as I was (drumroll) hacked again!!! ๐๐๐ yay!!! So I really needed monitoring and better logging enabled. When you spin up a GKE cluster, the VMโs that google provisions for you on GCE are using their proprietary node image Container-Optimized OS (cos). โcosโ is a stripped down GNU/Linux image. Unfortunately the install script Google provides will not run on this because in the install script the below piece of code cannot identify the cos image.
install() {
case "${ID:-}" in
amzn)
echo 'Installing agents for Amazon Linux.'
install_for_amazon_linux
;;
debian|ubuntu)
echo 'Installing agents for Debian or Ubuntu.'
install_for_debian
;;
rhel|centos)
echo 'Installing agents for RHEL or CentOS.'
install_for_redhat
;;
*)
# Fallback for systems lacking /etc/os-release.
if [[ -f /etc/debian_version ]]; then
echo 'Installing agents for Debian.'
install_for_debian
elif [[ -f /etc/redhat-release ]]; then
echo 'Installing agents for Red Hat.'
install_for_redhat
else
echo >&2 'Unidentifiable or unsupported platform.'
exit 1
fi
esac
}
To get stackdriver running you have to modify the node image for GKE to Ubuntu..
HOWEVER
There is also this monitoring tutorial and a logging tutorial specifically for kubernetes engine, which I didnโt find until just now. Maybe Iโm an idiot.
Just gonna reproduce everything I did today here for clarity..
gcloud beta container clusters update my-awesome-cluster --monitoring-service=monitoring.googleapis.com
and
gcloud beta container clusters update my-awesome-cluster --logging-service=logging.googleapis.com
I could also get Prometheus running as a pod in my cluster.. so that might be cool too. I may try this at some point. Prometheus may be overkill for what Iโm doing right now.