Difference between revisions of "Kubectl logs"
Jump to navigation
Jump to search
(Created page with "{{Draft}} == See also == * {{kubectl}} * {{K8s}} Category:Kubernetes") Tags: Mobile web edit, Mobile edit |
|||
(63 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{lowercase}} |
+ | https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs | ||
+ | * <code>[[kubectl logs --help]]</code> | ||
+ | * <code>[[kubectl]] logs [[my-pod]]</code> | ||
+ | * <code>[[kubectl logs my-pod -c my-container]]</code> | ||
+ | * <code>[[kubectl logs -n my-namespace my-pod]]</code> | ||
+ | * <code>[[kubectl logs --previous]] [[my-pod]]</code> | ||
+ | * <code>[[kubectl]] logs [[my-pod]] -f</code> or <code>[[kubectl]] logs [[my-pod]] --follow</code> | ||
+ | * <code>[[kubectl]] logs my-pod [[--tail]]=25</code> | ||
+ | * <code>kubectl logs my-pod -p</code> or <code>[[kubectl logs --previous]]</code> | ||
+ | |||
+ | kubectl logs ${POD_NAME} ${CONTAINER_NAME} | ||
+ | |||
+ | [[kubectl]] logs [[job/]][[your-cron-job-name]] | ||
+ | |||
+ | [[kubectl logs -f]] -n [[karpenter]] $(kubectl get pods -n karpenter -l karpenter=controller -o name) | ||
+ | [[kubectl logs -f -n karpenter -l app.kubernetes.io/name=karpenter -c controller]] | ||
+ | |||
+ | |||
+ | [[Labels]]: | ||
+ | * <code>[[kubectl logs -l]] app=elasticsearch</code> | ||
+ | * <code>[[kubectl]] logs your_container -c count</code> | ||
+ | |||
+ | kubectl logs | ||
+ | error: expected 'logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]'. | ||
+ | POD or TYPE/NAME is a required argument for the logs command | ||
+ | See 'kubectl logs -h' for help and examples | ||
+ | |||
+ | == Related == | ||
+ | * <code>[[kubectl exec]]</code> | ||
+ | * [[CKA v1.23]]: [[Evaluate cluster and node logging]] | ||
+ | * [[CKA v1.18]]: Display [[Kubernetes scheduler|scheduler]] events | ||
+ | * [[CKA v1.18]]: [[Manage cluster component logs]] | ||
+ | * [[CKA v1.18]]: [[Manage application logs]] | ||
+ | * [[CKA v1.15]], [[CKA v1.21]]: [[Understand container logging]] | ||
+ | * <code>[[stern]] (unmaintained)</code> | ||
+ | * <code>[[ktail]]</code> | ||
+ | * <code>[[kubectl top]]</code> | ||
+ | * <code>[[kubectl get events]]</code> | ||
+ | * [[Sidecar container]] | ||
+ | * [[Kubernetes logging]] | ||
+ | * [[Fluent Bit]] | ||
+ | * [[Pixie]] | ||
+ | * [[k logs -n grafana grafana]] | ||
== See also == | == See also == | ||
− | * {{kubectl}} | + | * {{kubectl logs}} |
− | * {{K8s}} | + | * {{kubectl get}} |
+ | * {{K8s troubleshooting}} | ||
+ | * {{Kubernetes info}} | ||
[[Category:Kubernetes]] | [[Category:Kubernetes]] |
Latest revision as of 07:26, 23 February 2024
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs
kubectl logs --help
kubectl logs my-pod
kubectl logs my-pod -c my-container
kubectl logs -n my-namespace my-pod
kubectl logs --previous my-pod
kubectl logs my-pod -p
orkubectl logs --previous
kubectl logs ${POD_NAME} ${CONTAINER_NAME}
kubectl logs job/your-cron-job-name
kubectl logs -f -n karpenter $(kubectl get pods -n karpenter -l karpenter=controller -o name) kubectl logs -f -n karpenter -l app.kubernetes.io/name=karpenter -c controller
kubectl logs -l app=elasticsearch
kubectl logs your_container -c count
kubectl logs error: expected 'logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]'. POD or TYPE/NAME is a required argument for the logs command See 'kubectl logs -h' for help and examples
Related[edit]
kubectl exec
- CKA v1.23: Evaluate cluster and node logging
- CKA v1.18: Display scheduler events
- CKA v1.18: Manage cluster component logs
- CKA v1.18: Manage application logs
- CKA v1.15, CKA v1.21: Understand container logging
stern (unmaintained)
ktail
kubectl top
kubectl get events
- Sidecar container
- Kubernetes logging
- Fluent Bit
- Pixie
- k logs -n grafana grafana
See also[edit]
kubectl logs, ktail, stern, --previous, -c
kubectl get
: [all
|componentstatus | pods | apiservices | events
|event
|nodes
|replicaset
|services
|svc
|namespaces
|hpa
|secret | deployments | serviceaccounts | endpoints | daemonset | networkpolicy
],kubectl get -h
- K8s troubleshooting:
kubectl logs, kubectl top, kubectl get events -A, kubectl describe pod
, Liveness, Readiness,Kubernetes events
, Pulling image, OOMKilled, ProbeWarning, Reason,FailedScheduling
,errImagePull, ImagePullBackOff
, Kubelet conditions:MemoryPressure, DiskPressure, KubeletHasSufficientPID, KubeletReady, kubectl [ debug | attach | exec ] kubectl cluster-info dump, SimKube, KWOK
- Kubectl information commands:
cluster-info
|view
|pods
|nodes
|services
|version
|describe | logs
Advertising: