DEV Community

Cheedge Lee
Cheedge Lee

Posted on • Originally published at notes-renovation.hashnode.dev

CKA Quick Check Points -- Logs & Configs

Quick recap for logs & configs. Details can click the title link or check the official doc.

1. Log

1.1 Files

  • /var/log/
    • Pod: /var/log/pods/<namespace>/<pod-name>/<container-name>.log
    • Etcd: /var/log/etcd.log
    • kubelet: /var/log/syslog

1.2 CMD

# 1. components log
grep kubelet /var/log/syslog
journalctl -u [kubectl|kube-controller-manager|kube-scheduler|kube-apiserver|etcd|docker|containerd]
kubectl logs <pod-name> -n kube-system
# 2. Pod log
kubectl describe pod <pod-name> -n kube-system
kubectl logs <pod-name> -c <container-name>
# use crictl or docker (in case when docker is used) to check the logs and process
# crictl ps/logs
Enter fullscreen mode Exit fullscreen mode

1.3 sidecar

sidecar container used for logging

official doc

2. Config

2.1 Files

  • /etc/kubernetes/: most k8s configuration files.
    • /etc/kubernetes/manifest: static pod config files
  • /var/lib/kubelet/: kubelet related data and configuration.
  • /var/lib/etcd/: etcd data.
  • /etc/systemd/system/: systemd service configuration files.

2.2 CMD

# View the active kubeconfig settings.
kubectl config view
# check the corresponding pods
kubectl describe pod <pod-name> -n kube-system
# use systemctl cat
systemctl cat [kubectl|kube-controller-manager|kube-scheduler|kube-apiserver|etcd|docker|containerd]
# can even use find
find / | grep kubeadm
Enter fullscreen mode Exit fullscreen mode

3. Context

kubectl config current-context
Enter fullscreen mode Exit fullscreen mode

4. Jobs

kubectl delete jobs --all
kubectl get pods -w
Enter fullscreen mode Exit fullscreen mode

Billboard image

Monitoring as code

With Checkly, you can use Playwright tests and Javascript to monitor end-to-end scenarios in your NextJS, Astro, Remix, or other application.

Get started now!

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay