Skip to content

core.v1.container

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

Index

Fields

fn new

new(name, image)

new returns a new container of given name and image

fn withArgs

withArgs(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"

fn withArgsMixin

withArgsMixin(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"

Note: This function appends passed data to existing values

fn withCommand

withCommand(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"

fn withCommandMixin

withCommandMixin(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"

Note: This function appends passed data to existing values

fn withEnv

withEnv(env)

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

fn withEnvFrom

withEnvFrom(envFrom)

"List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. 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."

fn withEnvFromMixin

withEnvFromMixin(envFrom)

"List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. 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."

Note: This function appends passed data to existing values

fn withEnvMap

withEnvMap(env)

withEnvMap works like withEnvMixin but accepts a key/value map, this map is converted a list of core.v1.envVar(key, value)`.

If the value is an object instead of a string, it is placed under the valueFrom key.

fn withEnvMixin

withEnvMixin(env)

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

Note: This function appends passed data to existing values

fn withImage

withImage(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."

fn withImagePullPolicy

withImagePullPolicy(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\n\n"

fn withName

withName(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."

fn withPorts

withPorts(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."

fn withPortsMixin

withPortsMixin(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."

Note: This function appends passed data to existing values

fn withStdin

withStdin(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."

fn withStdinOnce

withStdinOnce(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"

fn withTerminationMessagePath

withTerminationMessagePath(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."

fn withTerminationMessagePolicy

withTerminationMessagePolicy(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.\n\n"

fn withTty

withTty(tty)

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

fn withVolumeDevices

withVolumeDevices(volumeDevices)

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

fn withVolumeDevicesMixin

withVolumeDevicesMixin(volumeDevices)

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

Note: This function appends passed data to existing values

fn withVolumeMounts

withVolumeMounts(volumeMounts)

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

fn withVolumeMountsMixin

withVolumeMountsMixin(volumeMounts)

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

Note: This function appends passed data to existing values

fn withWorkingDir

withWorkingDir(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."

obj lifecycle

"Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted."

obj lifecycle.postStart

"LifecycleHandler defines a specific action that should be taken in a lifecycle hook. One and only one of the fields, except TCPSocket must be specified."

obj lifecycle.postStart.exec

"ExecAction describes a \"run in container\" action."

fn lifecycle.postStart.exec.withCommand

withCommand(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

fn lifecycle.postStart.exec.withCommandMixin

withCommandMixin(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

Note: This function appends passed data to existing values

obj lifecycle.postStart.httpGet

"HTTPGetAction describes an action based on HTTP Get requests."

fn lifecycle.postStart.httpGet.withHost

withHost(host)

"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead."

fn lifecycle.postStart.httpGet.withHttpHeaders

withHttpHeaders(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

fn lifecycle.postStart.httpGet.withHttpHeadersMixin

withHttpHeadersMixin(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

Note: This function appends passed data to existing values

fn lifecycle.postStart.httpGet.withPath

withPath(path)

"Path to access on the HTTP server."

fn lifecycle.postStart.httpGet.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."

fn lifecycle.postStart.httpGet.withScheme

withScheme(scheme)

"Scheme to use for connecting to the host. Defaults to HTTP.\n\n"

obj lifecycle.postStart.tcpSocket

"TCPSocketAction describes an action based on opening a socket"

fn lifecycle.postStart.tcpSocket.withHost

withHost(host)

"Optional: Host name to connect to, defaults to the pod IP."

fn lifecycle.postStart.tcpSocket.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."

obj lifecycle.preStop

"LifecycleHandler defines a specific action that should be taken in a lifecycle hook. One and only one of the fields, except TCPSocket must be specified."

obj lifecycle.preStop.exec

"ExecAction describes a \"run in container\" action."

fn lifecycle.preStop.exec.withCommand

withCommand(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

fn lifecycle.preStop.exec.withCommandMixin

withCommandMixin(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

Note: This function appends passed data to existing values

obj lifecycle.preStop.httpGet

"HTTPGetAction describes an action based on HTTP Get requests."

fn lifecycle.preStop.httpGet.withHost

withHost(host)

"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead."

fn lifecycle.preStop.httpGet.withHttpHeaders

withHttpHeaders(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

fn lifecycle.preStop.httpGet.withHttpHeadersMixin

withHttpHeadersMixin(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

Note: This function appends passed data to existing values

fn lifecycle.preStop.httpGet.withPath

withPath(path)

"Path to access on the HTTP server."

fn lifecycle.preStop.httpGet.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."

fn lifecycle.preStop.httpGet.withScheme

withScheme(scheme)

"Scheme to use for connecting to the host. Defaults to HTTP.\n\n"

obj lifecycle.preStop.tcpSocket

"TCPSocketAction describes an action based on opening a socket"

fn lifecycle.preStop.tcpSocket.withHost

withHost(host)

"Optional: Host name to connect to, defaults to the pod IP."

fn lifecycle.preStop.tcpSocket.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."

obj livenessProbe

"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic."

fn livenessProbe.withFailureThreshold

withFailureThreshold(failureThreshold)

"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1."

fn livenessProbe.withInitialDelaySeconds

withInitialDelaySeconds(initialDelaySeconds)

"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"

fn livenessProbe.withPeriodSeconds

withPeriodSeconds(periodSeconds)

"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1."

fn livenessProbe.withSuccessThreshold

withSuccessThreshold(successThreshold)

"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1."

fn livenessProbe.withTerminationGracePeriodSeconds

withTerminationGracePeriodSeconds(terminationGracePeriodSeconds)

"Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset."

fn livenessProbe.withTimeoutSeconds

withTimeoutSeconds(timeoutSeconds)

"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"

obj livenessProbe.exec

"ExecAction describes a \"run in container\" action."

fn livenessProbe.exec.withCommand

withCommand(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

fn livenessProbe.exec.withCommandMixin

withCommandMixin(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

Note: This function appends passed data to existing values

obj livenessProbe.grpc

fn livenessProbe.grpc.withPort

withPort(port)

"Port number of the gRPC service. Number must be in the range 1 to 65535."

fn livenessProbe.grpc.withService

withService(service)

"Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).\n\nIf this is not specified, the default behavior is defined by gRPC."

obj livenessProbe.httpGet

"HTTPGetAction describes an action based on HTTP Get requests."

fn livenessProbe.httpGet.withHost

withHost(host)

"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead."

fn livenessProbe.httpGet.withHttpHeaders

withHttpHeaders(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

fn livenessProbe.httpGet.withHttpHeadersMixin

withHttpHeadersMixin(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

Note: This function appends passed data to existing values

fn livenessProbe.httpGet.withPath

withPath(path)

"Path to access on the HTTP server."

fn livenessProbe.httpGet.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."

fn livenessProbe.httpGet.withScheme

withScheme(scheme)

"Scheme to use for connecting to the host. Defaults to HTTP.\n\n"

obj livenessProbe.tcpSocket

"TCPSocketAction describes an action based on opening a socket"

fn livenessProbe.tcpSocket.withHost

withHost(host)

"Optional: Host name to connect to, defaults to the pod IP."

fn livenessProbe.tcpSocket.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."

obj readinessProbe

"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic."

fn readinessProbe.withFailureThreshold

withFailureThreshold(failureThreshold)

"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1."

fn readinessProbe.withInitialDelaySeconds

withInitialDelaySeconds(initialDelaySeconds)

"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"

fn readinessProbe.withPeriodSeconds

withPeriodSeconds(periodSeconds)

"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1."

fn readinessProbe.withSuccessThreshold

withSuccessThreshold(successThreshold)

"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1."

fn readinessProbe.withTerminationGracePeriodSeconds

withTerminationGracePeriodSeconds(terminationGracePeriodSeconds)

"Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset."

fn readinessProbe.withTimeoutSeconds

withTimeoutSeconds(timeoutSeconds)

"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"

obj readinessProbe.exec

"ExecAction describes a \"run in container\" action."

fn readinessProbe.exec.withCommand

withCommand(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

fn readinessProbe.exec.withCommandMixin

withCommandMixin(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

Note: This function appends passed data to existing values

obj readinessProbe.grpc

fn readinessProbe.grpc.withPort

withPort(port)

"Port number of the gRPC service. Number must be in the range 1 to 65535."

fn readinessProbe.grpc.withService

withService(service)

"Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).\n\nIf this is not specified, the default behavior is defined by gRPC."

obj readinessProbe.httpGet

"HTTPGetAction describes an action based on HTTP Get requests."

fn readinessProbe.httpGet.withHost

withHost(host)

"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead."

fn readinessProbe.httpGet.withHttpHeaders

withHttpHeaders(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

fn readinessProbe.httpGet.withHttpHeadersMixin

withHttpHeadersMixin(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

Note: This function appends passed data to existing values

fn readinessProbe.httpGet.withPath

withPath(path)

"Path to access on the HTTP server."

fn readinessProbe.httpGet.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."

fn readinessProbe.httpGet.withScheme

withScheme(scheme)

"Scheme to use for connecting to the host. Defaults to HTTP.\n\n"

obj readinessProbe.tcpSocket

"TCPSocketAction describes an action based on opening a socket"

fn readinessProbe.tcpSocket.withHost

withHost(host)

"Optional: Host name to connect to, defaults to the pod IP."

fn readinessProbe.tcpSocket.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."

obj resources

"ResourceRequirements describes the compute resource requirements."

fn resources.withClaims

withClaims(claims)

"Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container.\n\nThis is an alpha field and requires enabling the DynamicResourceAllocation feature gate.\n\nThis field is immutable. It can only be set for containers."

fn resources.withClaimsMixin

withClaimsMixin(claims)

"Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container.\n\nThis is an alpha field and requires enabling the DynamicResourceAllocation feature gate.\n\nThis field is immutable. It can only be set for containers."

Note: This function appends passed data to existing values

fn resources.withLimits

withLimits(limits)

"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/"

fn resources.withLimitsMixin

withLimitsMixin(limits)

"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/"

Note: This function appends passed data to existing values

fn resources.withRequests

withRequests(requests)

"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/"

fn resources.withRequestsMixin

withRequestsMixin(requests)

"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/"

Note: This function appends passed data to existing values

obj securityContext

"SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence."

fn securityContext.withAllowPrivilegeEscalation

withAllowPrivilegeEscalation(allowPrivilegeEscalation)

"AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN Note that this field cannot be set when spec.os.name is windows."

fn securityContext.withPrivileged

withPrivileged(privileged)

"Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false. Note that this field cannot be set when spec.os.name is windows."

fn securityContext.withProcMount

withProcMount(procMount)

"procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows."

fn securityContext.withReadOnlyRootFilesystem

withReadOnlyRootFilesystem(readOnlyRootFilesystem)

"Whether this container has a read-only root filesystem. Default is false. Note that this field cannot be set when spec.os.name is windows."

fn securityContext.withRunAsGroup

withRunAsGroup(runAsGroup)

"The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows."

fn securityContext.withRunAsNonRoot

withRunAsNonRoot(runAsNonRoot)

"Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence."

fn securityContext.withRunAsUser

withRunAsUser(runAsUser)

"The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows."

obj securityContext.capabilities

"Adds and removes POSIX capabilities from running containers."

fn securityContext.capabilities.withAdd

withAdd(add)

"Added capabilities"

fn securityContext.capabilities.withAddMixin

withAddMixin(add)

"Added capabilities"

Note: This function appends passed data to existing values

fn securityContext.capabilities.withDrop

withDrop(drop)

"Removed capabilities"

fn securityContext.capabilities.withDropMixin

withDropMixin(drop)

"Removed capabilities"

Note: This function appends passed data to existing values

obj securityContext.seLinuxOptions

"SELinuxOptions are the labels to be applied to the container"

fn securityContext.seLinuxOptions.withLevel

withLevel(level)

"Level is SELinux level label that applies to the container."

fn securityContext.seLinuxOptions.withRole

withRole(role)

"Role is a SELinux role label that applies to the container."

fn securityContext.seLinuxOptions.withType

withType(type)

"Type is a SELinux type label that applies to the container."

fn securityContext.seLinuxOptions.withUser

withUser(user)

"User is a SELinux user label that applies to the container."

obj securityContext.seccompProfile

"SeccompProfile defines a pod/container's seccomp profile settings. Only one profile source may be set."

fn securityContext.seccompProfile.withLocalhostProfile

withLocalhostProfile(localhostProfile)

"localhostProfile indicates a profile defined in a file on the node should be used. The profile must be preconfigured on the node to work. Must be a descending path, relative to the kubelet's configured seccomp profile location. Must only be set if type is \"Localhost\"."

fn securityContext.seccompProfile.withType

withType(type)

"type indicates which kind of seccomp profile will be applied. Valid options are:\n\nLocalhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.\n\n"

obj securityContext.windowsOptions

"WindowsSecurityContextOptions contain Windows-specific options and credentials."

fn securityContext.windowsOptions.withGmsaCredentialSpec

withGmsaCredentialSpec(gmsaCredentialSpec)

"GMSACredentialSpec is where the GMSA admission webhook (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the GMSA credential spec named by the GMSACredentialSpecName field."

fn securityContext.windowsOptions.withGmsaCredentialSpecName

withGmsaCredentialSpecName(gmsaCredentialSpecName)

"GMSACredentialSpecName is the name of the GMSA credential spec to use."

fn securityContext.windowsOptions.withHostProcess

withHostProcess(hostProcess)

"HostProcess determines if a container should be run as a 'Host Process' container. This field is alpha-level and will only be honored by components that enable the WindowsHostProcessContainers feature flag. Setting this field without the feature flag will result in errors when validating the Pod. All of a Pod's containers must have the same effective HostProcess value (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). In addition, if HostProcess is true then HostNetwork must also be set to true."

fn securityContext.windowsOptions.withRunAsUserName

withRunAsUserName(runAsUserName)

"The UserName in Windows to run the entrypoint of the container process. Defaults to the user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence."

obj startupProbe

"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic."

fn startupProbe.withFailureThreshold

withFailureThreshold(failureThreshold)

"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1."

fn startupProbe.withInitialDelaySeconds

withInitialDelaySeconds(initialDelaySeconds)

"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"

fn startupProbe.withPeriodSeconds

withPeriodSeconds(periodSeconds)

"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1."

fn startupProbe.withSuccessThreshold

withSuccessThreshold(successThreshold)

"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1."

fn startupProbe.withTerminationGracePeriodSeconds

withTerminationGracePeriodSeconds(terminationGracePeriodSeconds)

"Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset."

fn startupProbe.withTimeoutSeconds

withTimeoutSeconds(timeoutSeconds)

"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"

obj startupProbe.exec

"ExecAction describes a \"run in container\" action."

fn startupProbe.exec.withCommand

withCommand(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

fn startupProbe.exec.withCommandMixin

withCommandMixin(command)

"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy."

Note: This function appends passed data to existing values

obj startupProbe.grpc

fn startupProbe.grpc.withPort

withPort(port)

"Port number of the gRPC service. Number must be in the range 1 to 65535."

fn startupProbe.grpc.withService

withService(service)

"Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).\n\nIf this is not specified, the default behavior is defined by gRPC."

obj startupProbe.httpGet

"HTTPGetAction describes an action based on HTTP Get requests."

fn startupProbe.httpGet.withHost

withHost(host)

"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead."

fn startupProbe.httpGet.withHttpHeaders

withHttpHeaders(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

fn startupProbe.httpGet.withHttpHeadersMixin

withHttpHeadersMixin(httpHeaders)

"Custom headers to set in the request. HTTP allows repeated headers."

Note: This function appends passed data to existing values

fn startupProbe.httpGet.withPath

withPath(path)

"Path to access on the HTTP server."

fn startupProbe.httpGet.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."

fn startupProbe.httpGet.withScheme

withScheme(scheme)

"Scheme to use for connecting to the host. Defaults to HTTP.\n\n"

obj startupProbe.tcpSocket

"TCPSocketAction describes an action based on opening a socket"

fn startupProbe.tcpSocket.withHost

withHost(host)

"Optional: Host name to connect to, defaults to the pod IP."

fn startupProbe.tcpSocket.withPort

withPort(port)

"IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number."