Pods logs¶
Print the logs for a container in a pod or specified resource.
Configuration¶
The full structure of the PodLogs
resource is documented here.
Features¶
Supported features | |
---|---|
Bindings support | |
Outputs support | |
Templating support | |
Operation checks support |
Test namespace¶
Chainsaw will default the scope to the ephemeral test namespace.
All namespaces¶
It is possible to consider all namespaces in the cluster by setting namespace: '*'
.
Examples¶
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: example
spec:
steps:
- try: ...
catch:
# all pods in the test namespace
- podLogs: {}
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: example
spec:
steps:
- try: ...
catch:
- podLogs:
# pods that have a name starting with the provided `my-pod`
name: my-pod
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: example
spec:
steps:
- try: ...
catch:
- podLogs:
# pods in the namespace `foo`
namespace: foo
Label selector¶
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: example
spec:
steps:
- try: ...
catch:
- podLogs:
# match pods using a label selector query
selector: app=my-app
Tail¶
Tip
By default, tail
will be 10
when a label selector is used, and all
if a pod name
is specified.
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: example
spec:
steps:
- try: ...
catch:
- podLogs:
tail: 30
Container¶
Tip
By default logs from all containers will be fetched.
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: example
spec:
steps:
- try: ...
catch:
- podLogs:
container: nginx