PodSpecV1 Class

Definition

Represents the specification of a Kubernetes Pod defined in version 1. This class is used to configure various attributes of a pod, including containers, networking, scheduling, and security settings.

[YamlDotNet.Serialization.YamlSerializable]
public sealed class PodSpecV1
[<YamlDotNet.Serialization.YamlSerializable>]
type PodSpecV1 = class
Public NotInheritable Class PodSpecV1
Inheritance
PodSpecV1
Attributes
YamlDotNet.Serialization.YamlSerializableAttribute

Constructors

PodSpecV1()

Properties

ActiveDeadlineSeconds

Specifies the duration in seconds relative to the start time that the pod may be active on the node. If the deadline is exceeded, the pod will be terminated by the system. This property can be useful for enforcing time limits for long-running pods.

Affinity

Gets or sets the affinity rules for the pod. Affinity specifies scheduling constraints for a pod to ensure it is scheduled onto a node that satisfies certain conditions. This can include nodeSelector-like or pod affinity/anti-affinity constraints.

AutomountServiceAccountToken

Determines whether the service account token should be automatically mounted to the pod or not. If set to true, it enables automatic mounting of the service account token. If set to false, the token will not be automatically mounted. Optional and defaults to the service account's value if not specified.

Containers

Represents the primary list of containers within the pod. These are the application-level containers that run within the desired Pod, and their specifications define the workloads the pod can execute.

DnsConfig

Represents the DNS configuration of a pod, encapsulating parameters that adjust the behavior or setup of DNS resolution for the pod.

DnsPolicy

Gets or sets the DNS policy for the pod. This property determines the DNS settings applied to the pod, such as how DNS resolution is configured. Common values include "ClusterFirst" and "Default".

EnableServiceLinks

Indicates whether information about services should be injected into the pod's environment variables. This property determines if service environment variables, such as <service_name></service_name>_SERVICE_HOST and <service_name></service_name>_SERVICE_PORT, are made available to containers within the pod.

EphemeralContainers

Represents the list of ephemeral containers within the pod specification. Ephemeral containers are used for troubleshooting purpose and do not persist across pod restarts. This property allows the specification of multiple ephemeral containers inside a pod.

HostAliases

Gets the list of HostAliasV1 objects that define custom mapping of IP addresses to hostnames. This property can be used to provide additional entries for the Pod's /etc/hosts file, enabling the Pod to resolve specified hostnames to the corresponding IP addresses without DNS.

HostIpc

Indicates whether the pod should use the host's IPC namespace. When set to true, the containers in the pod will share the IPC namespace with the host, allowing IPC resources (e.g., semaphores, message queues) to be accessible between the host and pod containers. This may be useful for certain applications that require inter-process communication with the host system. Use this property with caution as it exposes IPC resources on the host and might increase the risk of security vulnerabilities.

Hostname

Gets or sets the hostname of the pod. This property specifies the hostname field of the Kubernetes PodSpec configuration. If set, the value will be used as the hostname of the pod, overriding the default hostname which is generally derived from the pod name.

HostNetwork

Gets or sets a value indicating whether the pod uses the host network namespace. If set to true, the pod will have access to the host's network interfaces and IP. This is useful for applications requiring access to the host network but can have implications for security and network isolation.

HostPid

Specifies whether the pod should use the host's process ID (PID) namespace. When set to true, processes in the pod will share the host's PID namespace, allowing visibility and interaction with processes on the host. This can be useful for certain debugging or monitoring scenarios, but may pose a security risk. Use with caution in multi-tenant clusters or environments.

HostUsers

Determines whether the container(s) in the pod will run with the same user ID and group ID settings as the host. If set to true, containers will share the same host user namespace. If set to false or omitted, the containers will have their user and group IDs isolated within their own namespace. This setting impacts security configurations and should be used with caution.

ImagePullSecrets

Specifies a list of references to secrets to use for pulling images for the containers defined in the pod. Each item in the list is a reference to a secret containing credentials for accessing a private image registry. This allows customization of authentication methods for image pulling, especially in secure or restricted environments.

InitContainers

Represents a collection of initialization containers that run before the main containers in the pod are started. These containers are executed sequentially and must complete successfully before any normal containers are started. Initialization containers can perform setup tasks, such as loading configuration files or initializing data stores, required by the primary application containers.

NodeName

Specifies the name of the node on which the Pod should be scheduled. This is a binding decision that indicates the node where the Pod is intended to run. If not set, the scheduler automatically assigns a node for the Pod.

NodeSelector

Gets a dictionary of key-value pairs used to specify the node selector for the pod. The node selector enables you to define specific keys and values that a node must have for the pod to be scheduled on it.

Os

Gets or sets the operating system parameters for the pod. This property allows specifying details about the target operating system environment where the pod will run, if applicable.

Overhead

Represents the resource overhead associated with running a Pod. This property stores a dictionary where keys correspond to resource types (e.g., "cpu", "memory") and values represent the quantity of the respective resource. This overhead is taken into account when scheduling the Pod to ensure that sufficient resources are available on a node.

PreemptionPolicy

Indicates the preemption policy for the pod. This property defines whether a pod is eligible to preempt other pods for resources when scheduling or if it can be preempted itself. Acceptable values are "PreemptLowerPriority" to allow preemption or "Never" to prevent it. If not specified, the default behavior is to allow preemptions.

Priority

Gets or sets the priority value of the Pod. Priority is an integer value that determines the scheduling precedence of the Pod. Higher values correspond to higher priority, which influences the order in which Pods are scheduled when resources are constrained. This property is optional and, if not specified, the priority of the Pod is determined by its priority class or system default settings.

PriorityClassName

Gets or sets the name of the PriorityClass associated with the pod. This property is used to assign a priority to the pod. The priority determines the scheduling order for the pod and its preemption behavior in cases of resource contention. The PriorityClass must be configured in the cluster beforehand.

ReadinessGates

Gets the list of readiness gates for the Pod. A readiness gate specifies additional conditions that must be met for the Pod to be considered ready beyond the default conditions.

ResourceClaims

Gets the list of resource claims associated with the pod. Resource claims define the resource needs of the pod, such as specific volumes or compute resources, allowing it to dynamically allocate resources from the cluster.

RestartPolicy

Specifies the restart behavior for all containers within the pod. Determines when the containers should be restarted following termination. Common values include "Always", "OnFailure", and "Never".

RuntimeClassName

Specifies the RuntimeClass to use for running the pod. A RuntimeClass defines the container runtime configuration for the pods, such as enabling specific runtimes (e.g., gVisor, Kata Containers) or customizing runtime behaviors. This property is beneficial for tailoring runtime environments to meet specific workload requirements or enhance security. If not specified, the default RuntimeClass for the Kubernetes cluster will be used.

SchedulerName

Gets or sets the name of the scheduler to be used for this pod. This property allows specifying a custom scheduler for the pod instead of relying on the default scheduler. It is optional and defaults to null if not specified.

SchedulingGates

Represents a list of scheduling gates for a pod. Scheduling gates are used to control the scheduling process by requiring specific conditions to be met before a pod is eligible for scheduling.

SecurityContext

Gets or sets the security context for a pod. The security context defines the security attributes applied to the entire pod, including user and group IDs, SELinux options, and windows security settings when applicable.

ServiceAccount

Gets or sets the name of the service account to be used in the pod. A service account allows pods to access the Kubernetes API and other resources with appropriate permissions, and is useful for defining the identity under which the pod will run in the cluster.

ServiceAccountName

Gets or sets the name of the Kubernetes Service Account that the pod should use. This account can provide access to specific Kubernetes resources or external services within the cluster. If left null or empty, the default Service Account in the pod's namespace will be used.

SetHostnameAsFqdn

Gets or sets a value indicating whether the hostname of the pod should be set as its fully qualified ___domain name (FQDN). If true, the FQDN will be used as the pod's hostname. If false or unset, the hostname will not be modified.

ShareProcessNamespace

Gets or sets a value indicating whether the pod should share a single process namespace with all containers within the pod. If enabled, processes within one container can view and interact with processes in other containers, subject to namespace and security constraints.

Subdomain

Gets or sets the subdomain for the Pod. When specified, this allows the Pod to be part of a DNS subdomain. The subdomain must conform to DNS subdomain naming rules. This is typically used to configure a Pod's fully qualified ___domain name (FQDN).

TerminationGracePeriodSeconds

Gets or sets the duration in seconds that is allowed for a pod to terminate after receiving a termination signal. This property defines the grace period before forcefully killing the pod's containers, allowing processes to shut down gracefully. If set to null, the system default termination grace period will be used.

Tolerations

Represents the tolerations applied to a pod. Tolerations are used to allow (but do not require) the scheduling of pods onto nodes with matching taints. A pod can tolerate a taint by matching its key, value, and effect as specified in the toleration. This property includes a collection of TolerationV1 objects.

TopologySpreadConstraints

Gets the list of topology spread constraints for the pod. Topology spread constraints define how the pods are distributed across the topology domains based on configured parameters.

Volumes

Gets the list of volumes that can be mounted by containers in a Pod. Each volume in this list represents a storage resource that can be used inside the Pod for data persistence or sharing between containers.

Applies to