Show / Hide Table of Contents

Class V1Container

A single application container that you want to run within a pod.

Inheritance
object
V1Container
Implements
IEquatable<V1Container>
Inherited Members
object.GetType()
object.MemberwiseClone()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: k8s.Models
Assembly: KubernetesClient.dll
Syntax
public record V1Container : IEquatable<V1Container>

Constructors

View Source

V1Container()

Declaration
public V1Container()
View Source

V1Container(V1Container)

Declaration
protected V1Container(V1Container original)
Parameters
Type Name Description
V1Container original

Properties

View Source

Args

Arguments to the entrypoint. The container image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the \((VAR_NAME) syntax: i.e. "$\)(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell

Declaration
[JsonPropertyName("args")]
public IList<string> Args { get; set; }
Property Value
Type Description
IList<string>
View Source

Command

Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the \((VAR_NAME) syntax: i.e. "$\)(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell

Declaration
[JsonPropertyName("command")]
public IList<string> Command { get; set; }
Property Value
Type Description
IList<string>
View Source

Env

List of environment variables to set in the container. Cannot be updated.

Declaration
[JsonPropertyName("env")]
public IList<V1EnvVar> Env { get; set; }
Property Value
Type Description
IList<V1EnvVar>
View Source

EnvFrom

List of sources to populate environment variables in the container. The keys defined within a source may consist of any printable ASCII characters except '='. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.

Declaration
[JsonPropertyName("envFrom")]
public IList<V1EnvFromSource> EnvFrom { get; set; }
Property Value
Type Description
IList<V1EnvFromSource>
View Source

EqualityContract

Declaration
protected virtual Type EqualityContract { get; }
Property Value
Type Description
Type
View Source

Image

Container image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.

Declaration
[JsonPropertyName("image")]
public string Image { get; set; }
Property Value
Type Description
string
View Source

ImagePullPolicy

Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images

Declaration
[JsonPropertyName("imagePullPolicy")]
public string ImagePullPolicy { get; set; }
Property Value
Type Description
string
View Source

Lifecycle

Actions that the management system should take in response to container lifecycle events. Cannot be updated.

Declaration
[JsonPropertyName("lifecycle")]
public V1Lifecycle Lifecycle { get; set; }
Property Value
Type Description
V1Lifecycle
View Source

LivenessProbe

Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes

Declaration
[JsonPropertyName("livenessProbe")]
public V1Probe LivenessProbe { get; set; }
Property Value
Type Description
V1Probe
View Source

Name

Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.

Declaration
[JsonPropertyName("name")]
public string Name { get; set; }
Property Value
Type Description
string
View Source

Ports

List of ports to expose from the container. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Modifying this array with strategic merge patch may corrupt the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated.

Declaration
[JsonPropertyName("ports")]
public IList<V1ContainerPort> Ports { get; set; }
Property Value
Type Description
IList<V1ContainerPort>
View Source

ReadinessProbe

Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes

Declaration
[JsonPropertyName("readinessProbe")]
public V1Probe ReadinessProbe { get; set; }
Property Value
Type Description
V1Probe
View Source

ResizePolicy

Resources resize policy for the container.

Declaration
[JsonPropertyName("resizePolicy")]
public IList<V1ContainerResizePolicy> ResizePolicy { get; set; }
Property Value
Type Description
IList<V1ContainerResizePolicy>
View Source

Resources

Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/

Declaration
[JsonPropertyName("resources")]
public V1ResourceRequirements Resources { get; set; }
Property Value
Type Description
V1ResourceRequirements
View Source

RestartPolicy

RestartPolicy defines the restart behavior of individual containers in a pod. This overrides the pod-level restart policy. When this field is not specified, the restart behavior is defined by the Pod's restart policy and the container type. Additionally, setting the RestartPolicy as "Always" for the init container will have the following effect: this init container will be continually restarted on exit until all regular containers have terminated. Once all regular containers have completed, all init containers with restartPolicy "Always" will be shut down. This lifecycle differs from normal init containers and is often referred to as a "sidecar" container. Although this init container still starts in the init container sequence, it does not wait for the container to complete before proceeding to the next init container. Instead, the next init container starts immediately after this init container is started, or after any startupProbe has successfully completed.

Declaration
[JsonPropertyName("restartPolicy")]
public string RestartPolicy { get; set; }
Property Value
Type Description
string
View Source

RestartPolicyRules

Represents a list of rules to be checked to determine if the container should be restarted on exit. The rules are evaluated in order. Once a rule matches a container exit condition, the remaining rules are ignored. If no rule matches the container exit condition, the Container-level restart policy determines the whether the container is restarted or not. Constraints on the rules: - At most 20 rules are allowed. - Rules can have the same action. - Identical rules are not forbidden in validations. When rules are specified, container MUST set RestartPolicy explicitly even it if matches the Pod's RestartPolicy.

Declaration
[JsonPropertyName("restartPolicyRules")]
public IList<V1ContainerRestartRule> RestartPolicyRules { get; set; }
Property Value
Type Description
IList<V1ContainerRestartRule>
View Source

SecurityContext

SecurityContext defines the security options the container should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/

Declaration
[JsonPropertyName("securityContext")]
public V1SecurityContext SecurityContext { get; set; }
Property Value
Type Description
V1SecurityContext
View Source

StartupProbe

StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes

Declaration
[JsonPropertyName("startupProbe")]
public V1Probe StartupProbe { get; set; }
Property Value
Type Description
V1Probe
View Source

Stdin

Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.

Declaration
[JsonPropertyName("stdin")]
public bool? Stdin { get; set; }
Property Value
Type Description
bool?
View Source

StdinOnce

Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false

Declaration
[JsonPropertyName("stdinOnce")]
public bool? StdinOnce { get; set; }
Property Value
Type Description
bool?
View Source

TerminationMessagePath

Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.

Declaration
[JsonPropertyName("terminationMessagePath")]
public string TerminationMessagePath { get; set; }
Property Value
Type Description
string
View Source

TerminationMessagePolicy

Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.

Declaration
[JsonPropertyName("terminationMessagePolicy")]
public string TerminationMessagePolicy { get; set; }
Property Value
Type Description
string
View Source

Tty

Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.

Declaration
[JsonPropertyName("tty")]
public bool? Tty { get; set; }
Property Value
Type Description
bool?
View Source

VolumeDevices

volumeDevices is the list of block devices to be used by the container.

Declaration
[JsonPropertyName("volumeDevices")]
public IList<V1VolumeDevice> VolumeDevices { get; set; }
Property Value
Type Description
IList<V1VolumeDevice>
View Source

VolumeMounts

Pod volumes to mount into the container's filesystem. Cannot be updated.

Declaration
[JsonPropertyName("volumeMounts")]
public IList<V1VolumeMount> VolumeMounts { get; set; }
Property Value
Type Description
IList<V1VolumeMount>
View Source

WorkingDir

Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.

Declaration
[JsonPropertyName("workingDir")]
public string WorkingDir { get; set; }
Property Value
Type Description
string

Methods

View Source

Equals(object?)

Declaration
public override bool Equals(object? obj)
Parameters
Type Name Description
object obj
Returns
Type Description
bool
Overrides
object.Equals(object)
View Source

Equals(V1Container?)

Declaration
public virtual bool Equals(V1Container? other)
Parameters
Type Name Description
V1Container other
Returns
Type Description
bool
View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
int
Overrides
object.GetHashCode()
View Source

PrintMembers(StringBuilder)

Declaration
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
Type Name Description
StringBuilder builder
Returns
Type Description
bool
View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()

Operators

View Source

operator ==(V1Container?, V1Container?)

Declaration
public static bool operator ==(V1Container? left, V1Container? right)
Parameters
Type Name Description
V1Container left
V1Container right
Returns
Type Description
bool
View Source

operator !=(V1Container?, V1Container?)

Declaration
public static bool operator !=(V1Container? left, V1Container? right)
Parameters
Type Name Description
V1Container left
V1Container right
Returns
Type Description
bool

Implements

IEquatable<T>
  • View Source
In this article
Back to top Generated by DocFX