This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see Cake.Kubectl.
Summary
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
- Assembly
- Cake
.Kubectl .dll - Namespace
- Cake
.Kubectl - Base Types
-
- ToolSettings
- AutoToolSettings
graph BT
Type-->Base0["AutoToolSettings"]
click Base0 "/api/Cake.Kubectl/AutoToolSettings"
Base0-->Base1["ToolSettings"]
Type["KubectlLogsSettings"]
class Type type-node
Syntax
public sealed class KubectlLogsSettings : AutoToolSettings
Examples
# Return snapshot logs from pod nginx with only one container
kubectl logs nginx
# Return snapshot logs from pod nginx with multi containers
kubectl logs nginx --all-containers=true
# Return snapshot logs from all containers in pods defined by label app=nginx
kubectl logs -l app=nginx --all-containers=true
# Return snapshot of previous terminated ruby container logs from pod web-1
kubectl logs -p -c ruby web-1
# Begin streaming the logs of the ruby container in pod web-1
kubectl logs -f -c ruby web-1
# Begin streaming the logs from all containers in pods defined by label app=nginx
kubectl logs -f -l app=nginx --all-containers=true
# Display only the most recent 20 lines of output in pod nginx
kubectl logs --tail=20 nginx
# Show all logs from pod nginx written in the last hour
kubectl logs --since=1h nginx
# Show logs from a kubelet with an expired serving certificate
kubectl logs --insecure-skip-tls-verify-backend nginx
# Return snapshot logs from first container of a job named hello
kubectl logs job/hello
# Return snapshot logs from container nginx-1 of a deployment named nginx
kubectl logs deployment/nginx -c nginx-1
Attributes
Type | Description |
---|---|
Nullable |
|
NullableAttribute | |
Compiler |
Constructors
Name | Summary |
---|---|
KubectlLogsSettings |
Properties
Name | Value | Summary |
---|---|---|
AllContainers | Nullable |
--all-containers
Get all containers' logs in the pod(s).
|
Container | string |
-c, --container
Print the logs of this container
|
Follow | Nullable |
-f, --follow
Specify if the logs should be streamed.
|
IgnoreErrors | Nullable |
--ignore-errors
If watching / following pod logs, allow for any errors that occur to be non-fatal
|
Insecure |
Nullable |
--insecure-skip-tls-verify-backend
Skip verifying the identity of the kubelet that logs are requested from. In theory, an attacker could provide invalid log content back. You might want to use this if your kubelet serving certificates have expired.
|
LimitBytes | string |
--limit-bytes
Maximum bytes of logs to return. Defaults to no limit.
|
MaxLogRequests | string |
--max-log-requests
Specify maximum number of concurrent logs to follow when using by a selector. Defaults to 5.
|
PodRunningTimeout | string |
--pod-running-timeout
The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running
|
Prefix | Nullable |
--prefix
Prefix each log line with the log source (pod name and container name)
|
Previous | Nullable |
-p, --previous
If true, print the logs for the previous instance of the container in a pod if it exists.
|
Selector | string |
-l, --selector
Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints.
|
Since | string |
--since
Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used.
|
SinceTime | string |
--since-time
Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used.
|
Tail | Nullable |
--tail
Lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise 10, if a selector is provided.
|
Timestamps | Nullable |
--timestamps
Include timestamps on each line in the log output
|
Extension Methods
Name | Value | Summary |
---|---|---|
Dump |
string |
Get a basic string representation of specified object.
From LoggingExtensions
Requires the Cake.Incubator addin
|
IsIn |
bool |
Checks if the source is contained in a list
From EnumerableExtensions
Requires the Cake.Incubator addin
|
NotNull |
void |
Throws an exception if the specified parameter's value is null.
From Extensions
Requires the Cake.Ftp addin
|
NotNull |
void |
Throws an exception if the specified parameter's value is null.
From IssuesArgumentChecks
Requires the Cake.Issues addin
|
ThrowIfNull |
T |
Throws a
System.ArgumentNullException with a specific message if the value is null, otherwise returns the value
From AssertExtensions
Requires the Cake.Incubator addin
|
ThrowIfNull |
T |
Throws a
System.ArgumentNullException if the value is null, otherwise returns the value
From AssertExtensions
Requires the Cake.Incubator addin
|
ToDictionary |
IDictionary |
From ObjectHelpers
Requires the Cake.DeployParams addin
|
To |
string |
Returns the string value or a
Not set > markup suitable for Spectre.Console.
From StringExtensions
Requires the Cake.Issues addin
|