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
Execute a command in a container.
- 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["KubectlExecSettings"]
class Type type-node
Syntax
public sealed class KubectlExecSettings : AutoToolSettings
Examples
# Get output from running the 'date' command from pod mypod, using the first container by default
kubectl exec mypod -- date
# Get output from running the 'date' command in ruby-container from pod mypod
kubectl exec mypod -c ruby-container -- date
# Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod
# and sends stdout/stderr from 'bash' back to the client
kubectl exec mypod -c ruby-container -i -t -- bash -il
# List contents of /usr from the first container of pod mypod and sort by modification time
# If the command you want to execute in the pod has any flags in common (e.g. -i),
# you must use two dashes (--) to separate your command's flags/arguments
# Also note, do not surround your command and its flags/arguments with quotes
# unless that is how you would execute it normally (i.e., do ls -t /usr, not "ls -t /usr")
kubectl exec mypod -i -t -- ls -t /usr
# Get output from running 'date' command from the first pod of the deployment mydeployment, using the first container by default
kubectl exec deploy/mydeployment -- date
# Get output from running 'date' command from the first pod of the service myservice, using the first container by default
kubectl exec svc/myservice -- date
Attributes
Type | Description |
---|---|
Nullable |
|
NullableAttribute | |
Compiler |
Constructors
Name | Summary |
---|---|
KubectlExecSettings |
Properties
Name | Value | Summary |
---|---|---|
Container | string |
-c, --container
Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen
|
Filename | string |
-f, --filename
to use to exec into the resource
|
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
|
Quiet | Nullable |
-q, --quiet
Only print output from the remote session
|
Stdin | Nullable |
-i, --stdin
Pass stdin to the container
|
Tty | Nullable |
-t, --tty
Stdin is a TTY
|
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 IssuesArgumentChecks
Requires the Cake.Issues addin
|
NotNull |
void |
Throws an exception if the specified parameter's value is null.
From Extensions
Requires the Cake.Ftp 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
|