Difference between revisions of "Kubectl logs"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(20 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
* <code>[[kubectl logs --help]]</code>
 
* <code>[[kubectl logs --help]]</code>
 
* <code>[[kubectl]] logs [[my-pod]]</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]] -f</code> or <code>[[kubectl]] logs [[my-pod]] --follow</code>
 
* <code>[[kubectl]] logs my-pod [[--tail]]=25</code>
 
* <code>[[kubectl]] logs my-pod [[--tail]]=25</code>
 +
 
* <code>kubectl logs my-pod -p</code> or <code>[[kubectl logs --previous]]</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]]:
 
[[Labels]]:
* <code>kubectl logs -l app=elasticsearch</code>
+
* <code>[[kubectl logs -l]] app=elasticsearch</code>
 
* <code>[[kubectl]] logs your_container -c count</code>
 
* <code>[[kubectl]] logs your_container -c count</code>
  
Line 24: Line 36:
 
* [[CKA v1.18]]: [[Manage application logs]]
 
* [[CKA v1.18]]: [[Manage application logs]]
 
* [[CKA v1.15]], [[CKA v1.21]]: [[Understand container logging]]
 
* [[CKA v1.15]], [[CKA v1.21]]: [[Understand container logging]]
* <code>[[stern -A .]]</code>
+
* <code>[[stern]] (unmaintained)</code>
 
* <code>[[ktail]]</code>
 
* <code>[[ktail]]</code>
 
* <code>[[kubectl top]]</code>
 
* <code>[[kubectl top]]</code>
[[kubectl get events]]
+
* <code>[[kubectl get events]]</code>
 
* [[Sidecar container]]
 
* [[Sidecar container]]
 
* [[Kubernetes logging]]
 
* [[Kubernetes logging]]
 
* [[Fluent Bit]]
 
* [[Fluent Bit]]
 
* [[Pixie]]
 
* [[Pixie]]
 +
* [[k logs -n grafana grafana]]
  
 
== See also ==
 
== See also ==
 
* {{kubectl logs}}
 
* {{kubectl logs}}
* {{kubectl}}
+
* {{kubectl get}}
* {{K8s}}
+
* {{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 ${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:

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]

See also[edit]

Advertising: