CKA - Metrics Logging

Metrics Server Checks

  • kubectl top node
  • kubectl top nodes
  • kubectl top pod
  • kubectl top pod -A
  • kubectl top pod <pod-name> -n <namespace>

Logging Commands

  • kubectl logs <pod-name> -n <namespace>
  • kubectl logs <pod-name> -c <container-name> -n <namespace>
  • kubectl logs -f <pod-name> -n <namespace>
  • kubectl logs --previous <pod-name> -n <namespace>
  • kubectl exec webapp -- cat /log/app.log

Quick Reminder

  • kubectl top requires Metrics Server to be installed in the cluster.
  • Use kubectl top node for node CPU and memory usage.
  • Use kubectl logs when you need application output for troubleshooting.