In this chapter, we focus on recipes around monitoring and logging, both on the infrastructure and on the application level. In the context of Kubernetes, different roles typically have different scopes:
Administrator roles, such as cluster admins, networking operations folks, or namespace-level admins, focus on infrastructure aspects. Exemplary questions might be: Are nodes healthy? Shall we add a worker node? What is the cluster-wide utilization? Are users close to their usage quotas?
Developer roles mainly think and act in the context of their applications, which may well be—in the age of microservices—a handful to a dozen. For example, a person in a developer role might ask: Do I have enough resources allocated to run my app? How many replicas should I scale my app to? Do I have access to the right volumes, and how full are they? Is one of my apps failing and, if so, why?
We will first discuss recipes around cluster-internal monitoring leveraging Kubernetes liveness and readiness probes, then focus on monitoring with Heapster and Prometheus, and finally cover logging-related recipes.
You want to access the logs of the application running inside a container that is running in a specific pod.
kubectl logs command. To see the various options, check the usage, like so:
$ kubectl logs --help | more Print the logs for a container in a pod or specified resource. If the pod ...