container

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

Constuctors

Functions
  • withArgs

    withArgs(args)
    

    Arguments to the entrypoint. The docker 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. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(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


  • withArgsMixin

    withArgsMixin(args)
    

    Arguments to the entrypoint. The docker 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. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(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


  • withCommand

    withCommand(command)
    

    Entrypoint array. Not executed within a shell. The docker 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. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(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


  • withCommandMixin

    withCommandMixin(command)
    

    Entrypoint array. Not executed within a shell. The docker 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. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(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


  • withEnv

    withEnv(env)
    

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

    withEnv takes an array of type envType. You can create an instance of envType with hidden.core.v1.envVar.new().

    see hidden.core.v1.envVar


  • 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.

    withEnvFrom takes an array of type envFromType. You can create an instance of envFromType with hidden.core.v1.envFromSource.new().

    see hidden.core.v1.envFromSource


  • 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.

    withEnvFromMixin takes an array of type envFromType. You can create an instance of envFromType with hidden.core.v1.envFromSource.new().

    see hidden.core.v1.envFromSource


  • withEnvMixin

    withEnvMixin(env)
    

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

    withEnvMixin takes an array of type envType. You can create an instance of envType with hidden.core.v1.envVar.new().

    see hidden.core.v1.envVar


  • withImage

    withImage(image)
    

    Docker 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.


  • 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


  • 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.


  • withPorts

    withPorts(ports)
    

    List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. 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. Cannot be updated.

    withPorts takes an array of type portsType. You can create an instance of portsType with hidden.core.v1.containerPort.new().

    see hidden.core.v1.containerPort


  • withPortsMixin

    withPortsMixin(ports)
    

    List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. 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. Cannot be updated.

    withPortsMixin takes an array of type portsType. You can create an instance of portsType with hidden.core.v1.containerPort.new().

    see hidden.core.v1.containerPort


  • 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.


  • 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


  • 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.


  • 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.


  • withTty

    withTty(tty)
    

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


  • withVolumeDevices

    withVolumeDevices(volumeDevices)
    

    volumeDevices is the list of block devices to be used by the container. This is a beta feature.

    withVolumeDevices takes an array of type volumeDevicesType. You can create an instance of volumeDevicesType with hidden.core.v1.volumeDevice.new().

    see hidden.core.v1.volumeDevice


  • withVolumeDevicesMixin

    withVolumeDevicesMixin(volumeDevices)
    

    volumeDevices is the list of block devices to be used by the container. This is a beta feature.

    withVolumeDevicesMixin takes an array of type volumeDevicesType. You can create an instance of volumeDevicesType with hidden.core.v1.volumeDevice.new().

    see hidden.core.v1.volumeDevice


  • withVolumeMounts

    withVolumeMounts(volumeMounts)
    

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

    withVolumeMounts takes an array of type volumeMountsType. You can create an instance of volumeMountsType with hidden.core.v1.volumeMount.new().

    see hidden.core.v1.volumeMount


  • withVolumeMountsMixin

    withVolumeMountsMixin(volumeMounts)
    

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

    withVolumeMountsMixin takes an array of type volumeMountsType. You can create an instance of volumeMountsType with hidden.core.v1.volumeMount.new().

    see hidden.core.v1.volumeMount


  • 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.


Mixins
  • lifecycle

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


    Functions
    Mixins
    • postStart

      PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks


      Functions
      Mixins
      • exec

        One and only one of the following should be specified. Exec specifies the action to take.


        Functions
        • mixinInstance

          mixinInstance(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.


        • 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.


      • httpGet

        HTTPGet specifies the http request to perform.


        Functions
        • mixinInstance

          mixinInstance(httpGet)
          


        • withHost

          withHost(host)
          

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


        • withHttpHeaders

          withHttpHeaders(httpHeaders)
          

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

          withHttpHeaders takes an array of type httpHeadersType. You can create an instance of httpHeadersType with hidden.core.v1.httpHeader.new().

          see hidden.core.v1.httpHeader


        • withHttpHeadersMixin

          withHttpHeadersMixin(httpHeaders)
          

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

          withHttpHeadersMixin takes an array of type httpHeadersType. You can create an instance of httpHeadersType with hidden.core.v1.httpHeader.new().

          see hidden.core.v1.httpHeader


        • withPath

          withPath(path)
          

          Path to access on the HTTP server.


        • withPort

          withPort(port)
          

          Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.


        • withScheme

          withScheme(scheme)
          

          Scheme to use for connecting to the host. Defaults to HTTP.


      • tcpSocket

        TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported


        Functions
        • mixinInstance

          mixinInstance(tcpSocket)
          


        • withHost

          withHost(host)
          

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


        • withPort

          withPort(port)
          

          Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.


    • preStop

      PreStop is called immediately before a container is terminated due to an API request or management event such as liveness probe failure, preemption, resource contention, etc. The handler is not called if the container crashes or exits. The reason for termination is passed to the handler. The Pod's termination grace period countdown begins before the PreStop hooked is executed. Regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period. Other management of the container blocks until the hook completes or until the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks


      Functions
      Mixins
      • exec

        One and only one of the following should be specified. Exec specifies the action to take.


        Functions
        • mixinInstance

          mixinInstance(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.


        • 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.


      • httpGet

        HTTPGet specifies the http request to perform.


        Functions
        • mixinInstance

          mixinInstance(httpGet)
          


        • withHost

          withHost(host)
          

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


        • withHttpHeaders

          withHttpHeaders(httpHeaders)
          

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

          withHttpHeaders takes an array of type httpHeadersType. You can create an instance of httpHeadersType with hidden.core.v1.httpHeader.new().

          see hidden.core.v1.httpHeader


        • withHttpHeadersMixin

          withHttpHeadersMixin(httpHeaders)
          

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

          withHttpHeadersMixin takes an array of type httpHeadersType. You can create an instance of httpHeadersType with hidden.core.v1.httpHeader.new().

          see hidden.core.v1.httpHeader


        • withPath

          withPath(path)
          

          Path to access on the HTTP server.


        • withPort

          withPort(port)
          

          Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.


        • withScheme

          withScheme(scheme)
          

          Scheme to use for connecting to the host. Defaults to HTTP.


      • tcpSocket

        TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported


        Functions
        • mixinInstance

          mixinInstance(tcpSocket)
          


        • withHost

          withHost(host)
          

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


        • withPort

          withPort(port)
          

          Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.


  • 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


    Functions
    Mixins
    • exec

      One and only one of the following should be specified. Exec specifies the action to take.


      Functions
      • mixinInstance

        mixinInstance(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.


      • 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.


    • httpGet

      HTTPGet specifies the http request to perform.


      Functions
      • mixinInstance

        mixinInstance(httpGet)
        


      • withHost

        withHost(host)
        

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


      • withHttpHeaders

        withHttpHeaders(httpHeaders)
        

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

        withHttpHeaders takes an array of type httpHeadersType. You can create an instance of httpHeadersType with hidden.core.v1.httpHeader.new().

        see hidden.core.v1.httpHeader


      • withHttpHeadersMixin

        withHttpHeadersMixin(httpHeaders)
        

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

        withHttpHeadersMixin takes an array of type httpHeadersType. You can create an instance of httpHeadersType with hidden.core.v1.httpHeader.new().

        see hidden.core.v1.httpHeader


      • withPath

        withPath(path)
        

        Path to access on the HTTP server.


      • withPort

        withPort(port)
        

        Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.


      • withScheme

        withScheme(scheme)
        

        Scheme to use for connecting to the host. Defaults to HTTP.


    • tcpSocket

      TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported


      Functions
      • mixinInstance

        mixinInstance(tcpSocket)
        


      • withHost

        withHost(host)
        

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


      • withPort

        withPort(port)
        

        Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.


  • 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


    Functions
    Mixins
    • exec

      One and only one of the following should be specified. Exec specifies the action to take.


      Functions
      • mixinInstance

        mixinInstance(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.


      • 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.


    • httpGet

      HTTPGet specifies the http request to perform.


      Functions
      • mixinInstance

        mixinInstance(httpGet)
        


      • withHost

        withHost(host)
        

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


      • withHttpHeaders

        withHttpHeaders(httpHeaders)
        

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

        withHttpHeaders takes an array of type httpHeadersType. You can create an instance of httpHeadersType with hidden.core.v1.httpHeader.new().

        see hidden.core.v1.httpHeader


      • withHttpHeadersMixin

        withHttpHeadersMixin(httpHeaders)
        

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

        withHttpHeadersMixin takes an array of type httpHeadersType. You can create an instance of httpHeadersType with hidden.core.v1.httpHeader.new().

        see hidden.core.v1.httpHeader


      • withPath

        withPath(path)
        

        Path to access on the HTTP server.


      • withPort

        withPort(port)
        

        Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.


      • withScheme

        withScheme(scheme)
        

        Scheme to use for connecting to the host. Defaults to HTTP.


    • tcpSocket

      TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported


      Functions
      • mixinInstance

        mixinInstance(tcpSocket)
        


      • withHost

        withHost(host)
        

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


      • withPort

        withPort(port)
        

        Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.


  • resources

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


    Functions
  • securityContext

    Security options the pod should run with. More info: https://kubernetes.io/docs/concepts/policy/security-context/ More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/


    Functions
    • mixinInstance

      mixinInstance(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


    • withPrivileged

      withPrivileged(privileged)
      

      Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.


    • 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.


    • 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.


    • 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.


    • 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.


    Mixins
    • capabilities

      The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime.


      Functions
    • seLinuxOptions

      The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.


      Functions
      • mixinInstance

        mixinInstance(seLinuxOptions)
        


      • withLevel

        withLevel(level)
        

        Level is SELinux level label that applies to the container.


      • withRole

        withRole(role)
        

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


      • withType

        withType(type)
        

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


      • withUser

        withUser(user)
        

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


    • windowsOptions

      Windows security options.


      Functions
      • mixinInstance

        mixinInstance(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. This field is alpha-level and is only honored by servers that enable the WindowsGMSA feature flag.


      • withGmsaCredentialSpecName

        withGmsaCredentialSpecName(gmsaCredentialSpecName)
        

        GMSACredentialSpecName is the name of the GMSA credential spec to use. This field is alpha-level and is only honored by servers that enable the WindowsGMSA feature flag.