Difference between revisions of "Kubernetes/Monitoring"

From Ever changing code
Jump to navigation Jump to search
(Created page with "= Monitor cluster resources = In order to get cluster resources you need a metric collector plugin. Popular one is <tt>heapster</tt> that exposes <tt>metric-server</tt> servic...")
 
Line 20: Line 20:
kubectl top pods group-context --containers # CPU,memory of the containers inside the pod
kubectl top pods group-context --containers # CPU,memory of the containers inside the pod
</source>
</source>
= Liveness and Readiness probes =
Check this [https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-setting-up-health-checks-with-readiness-and-liveness-probes Visual explanation]

Revision as of 09:18, 25 September 2019

Monitor cluster resources

In order to get cluster resources you need a metric collector plugin. Popular one is heapster that exposes metric-server service. The below commands relay on its API to get data:

Install metrics-server

git clone https://github.com/kubernetes-incubator/metrics-server.git
kubectl apply -f ~/metrics-server/deploy/1.8+/

Get metrics

# verify metrics server API
kubectl get --raw /apis/metrics.k8s.io/

kubectl top node               # CPU,memory utilization of the nodes in your cluster
kubectl top pods               # CPU,memory utilization of the pods in your cluster
kubectl top pods -A            # CPU,memory of pods in all namespaces
kubectl top pod -l run=<label> # CPU and memory of pods with a label selector:
kubectl top pod <pod-name>     # CPU,memory of a specific pod
kubectl top pods group-context --containers # CPU,memory of the containers inside the pod

Liveness and Readiness probes

Check this Visual explanation