Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

Deep Dive & Troubleshoot using Kubernetes logs & its Structure & Location

Here is a detailed table summarizing the log file locations, purposes, and use cases for Kubernetes logs:


Comprehensive Table of Kubernetes Logs

Log Directory/LocationLog File(s)PurposeUse Case
/var/log/containers/<pod-name>_<namespace>_<container-name>-<container-id>.logLogs for each container in the pods.Debugging container-specific issues.
/var/log/pods/<namespace>_<pod-name>_<uid>/<container-name>-stdout.log<namespace>_<pod-name>_<uid>/<container-name>-stderr.logstdout.log: Logs standard output.stderr.log: Logs standard error.Debugging container logs specific to pods.
/var/log/kubelet/kubelet.logaudit.logerror.logkubelet.log: Node-level kubelet events.audit.log: Logs kubelet actions.error.log: Kubelet error logs.Diagnosing issues with pod scheduling and node management.
/var/log/kube-apiserver/apiserver.logaudit.logerror.logapiserver.log: API server events.audit.log: API request trails.error.log: API server errors.Monitoring API requests, failures, and unauthorized access.
/var/log/kube-scheduler/scheduler.logerror.logscheduler.log: Logs pod placement decisions.error.log: Scheduler-related errors.Debugging pod scheduling failures and resource allocation.
/var/log/kube-controller-manager/controller-manager.logerror.logcontroller-manager.log: Logs controller activities.error.log: Errors in controller manager.Troubleshooting replication, scaling, and resource management.
/var/log/etcd/etcd.logsnapshot.logerror.logetcd.log: Main etcd datastore logs.snapshot.log: Logs for etcd snapshots.error.log: Logs etcd errors.Debugging cluster state synchronization and data corruption issues.
/var/log/containerd/containerd.logerror.logcontainerd.log: Logs container runtime events.error.log: Errors related to container runtime.Debugging container runtime (image pulling, container start).
/var/log/network/cni.logflannel.logcalico.logerror.logcni.log: Container Network Interface logs.flannel/calico.log: Specific network provider logs.error.log: Network errors.Troubleshooting pod networking and connectivity issues.
/var/log/node/syslogmessagesdmesg.logauth.logerror.logsyslog/messages: General system logs.dmesg.log: Hardware/boot info.auth.log: SSH and sudo authentication logs.error.log: Node-level error logs.Debugging hardware, authentication, and boot issues.

Detailed Explanation of Logs

Log TypeComponent/ServiceKey Focus
Container LogsIndividual Pods/ContainersApplication-level logs (stdout and stderr).
Node LogsKubelet and System LogsLogs at the node level for resource management.
Control Plane LogsScheduler, Controller ManagerLogs for cluster-level management and decisions.
API Server LogsAPI ServerTracks API requests, errors, and audit trails.
Networking LogsCNI Plugins (Flannel, Calico)Network-related logs and troubleshooting.
Datastore LogsetcdLogs related to cluster state storage and retrieval.
Runtime LogscontainerdLogs for container lifecycle management.

This table provides a clear breakdown of each log directory, its log files, purposes, and common use cases, making it easy for administrators to locate and analyze logs effectively in a Kubernetes environment.

Kubernetes Logging Directory Structure Tutorial

Root Directory (/var/log/)

The main logging directory in Kubernetes contains several important subdirectories:

1. Container Logs

/var/log/containers/Code language: JavaScript (javascript)
  • Contains logs for each container in pods
  • Naming format: -.log
  • Useful for debugging individual container issues

2. Pod Logs

/var/log/pods/Code language: JavaScript (javascript)
  • Contains namespace-specific pod logs
  • Structure: /
  • Two important log types:
  • stdout.log: Standard output logs
  • stderr.log: Standard error logs

3. Kubelet Logs

/var/log/kubelet/Code language: JavaScript (javascript)
  • kubelet.log: Main kubelet service logs
  • audit.log: Kubelet action audit logs
  • error.log: Kubelet error logs

4. API Server Logs

/var/log/kube-apiserver/Code language: JavaScript (javascript)
  • apiserver.log: Main API server events
  • audit.log: API request audit logs
  • error.log: API server error logs

5. Scheduler Logs

/var/log/kube-scheduler/Code language: JavaScript (javascript)
  • scheduler.log: Pod placement logs
  • error.log: Scheduler error logs

6. Controller Manager Logs

/var/log/kube-controller-manager/Code language: JavaScript (javascript)
  • controller-manager.log: Controller operations
  • error.log: Controller manager errors

7. etcd Logs

/var/log/etcd/Code language: JavaScript (javascript)
  • etcd.log: Main etcd database logs
  • snapshot.log: etcd snapshot logs
  • error.log: etcd error logs

8. Container Runtime Logs

/var/log/containerd/Code language: JavaScript (javascript)
  • containerd.log: Container runtime logs
  • error.log: Runtime error logs

9. Network Logs

/var/log/network/Code language: JavaScript (javascript)
  • cni.log: Container Network Interface logs
  • flannel.log/calico.log: CNI provider specific logs
  • error.log: Network-related errors

10. Node Logs

/var/log/node/Code language: JavaScript (javascript)
  • syslog: System level logs (Ubuntu/Debian)
  • messages: System logs (RHEL/CentOS)
  • dmesg.log: Hardware/boot logs
  • auth.log: SSH/sudo authentication logs
  • error.log: Node-level errors

Best Practices for Log Management

  1. Regular log rotation to prevent disk space issues
  2. Implement log aggregation solutions
  3. Set appropriate log levels
  4. Use namespace-based log organization
  5. Monitor error logs frequently
  6. Implement log retention policies

Common Log Investigation Commands

# View container logs
kubectl logs <pod-name> -n <namespace>

# View previous container logs
kubectl logs <pod-name> -n <namespace> --previous

# Stream logs in real-time
kubectl logs -f <pod-name> -n <namespace>

# View logs with timestamps
kubectl logs <pod-name> -n <namespace> --timestamps=trueCode language: HTML, XML (xml)

This directory structure allows for efficient troubleshooting and monitoring of all components in a Kubernetes cluster, from individual containers to system-level events.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
Iโ€™m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

List of containerized storage orchestration in Kubernetes

List of Containerized Storage Orchestration Solutions in Kubernetes (2026 Edition) Kubernetes has become excellent at orchestrating stateless applications, but stateful workloads still need a proper storage layer….

Read More

Understanding Authentication & Authorization in kubernetes

Authentication – How User’s access should be allowed? The process or action of verifying the identity of a user or process.Authorization – What Access and till what…

Read More

Kubernetes 1.23.6 Cluster Setup Master and Worker in Ubuntu 20.04

Latest doc – https://github.com/certifications-tutorials/kubernetes-cluster-setup Following commands would help you to create 1 Master and 1 Node in same VM. Run Following commands in Master Node Run following…

Read More

Kubernetes PersistentVolume, PersistentVolumeClaim, volume using hostPath

pv.yaml $ kubectl create -f pv.yaml $ kubectl get pv pvc.yaml $ kubectl create -f pvc.yaml $ kubectl get pvc pod.yaml Rajesh Kumar Iโ€™m a DevOps/SRE/DevSecOps/Cloud Expert…

Read More

Kubernetes: Working with ReplicationController

A ReplicationController is a Kubernetes controller that ensures that a specified number of pod replicas are running at any one time. In other words, a ReplicationController makes…

Read More

Kubernetes Tutorials: Pod Load balancing using Service

In Kubernetes, a Service is an abstraction that defines a logical set of pods and a policy by which to access them. It provides a stable network…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x