How do I debug a pod?

A. With entering the pod

Use this command to access the pod shell:

kubectl exec -it <pod-name> -n opsramp-agent -- sh
Example:
kubectl exec -it opsramp-master-67ff695467-xr5bg -n opsramp-agent -- sh

You can use the same command for worker pods by replacing the pod name.

B. Without entering the pod

Use this command to view logs:

kubectl logs <pod-name> -n opsramp-agent
To view live logs:
kubectl logs <pod-name> -n opsramp-agent -f

C. Check logs from inside the pod

  1. Enter the pod using.
    kubectl exec -it <pod-name> -n opsramp-agent -- sh
  2. Go to the logs directory.
    /var/log/opsramp/
  3. List the log files:
    ls

Log file meanings:

  • agent.log: Logs from the K8s-2.0 agent.
  • infra-kube-otel-collector.log: Metrics from Kubernetes cluster components.
  • workload-kube-otel-collector.log: Metrics from workloads.