Difference between revisions of "Kubectl logs"

From wikieduonline
Jump to navigation Jump to search
Line 4: Line 4:
 
* <code>[[kubectl]] logs [[my-pod]]</code>
 
* <code>[[kubectl]] logs [[my-pod]]</code>
 
* <code>[[kubectl logs my-pod -c my-container]]</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 --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>

Revision as of 10:56, 7 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 -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

See also

Advertising: