Show / Hide Table of Contents

Class V1SecurityContext

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.

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

Constructors

View Source

V1SecurityContext()

Declaration
public V1SecurityContext()
View Source

V1SecurityContext(V1SecurityContext)

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

Properties

View Source

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.

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

AppArmorProfile

appArmorProfile is the AppArmor options to use by this container. If set, this profile overrides the pod's appArmorProfile. Note that this field cannot be set when spec.os.name is windows.

Declaration
[JsonPropertyName("appArmorProfile")]
public V1AppArmorProfile AppArmorProfile { get; set; }
Property Value
Type Description
V1AppArmorProfile
View Source

Capabilities

The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime. Note that this field cannot be set when spec.os.name is windows.

Declaration
[JsonPropertyName("capabilities")]
public V1Capabilities Capabilities { get; set; }
Property Value
Type Description
V1Capabilities
View Source

EqualityContract

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

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.

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

ProcMount

procMount denotes the type of proc mount to use for the containers. The default value is Default 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.

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

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.

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

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.

Declaration
[JsonPropertyName("runAsGroup")]
public long? RunAsGroup { get; set; }
Property Value
Type Description
long?
View Source

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.

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

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.

Declaration
[JsonPropertyName("runAsUser")]
public long? RunAsUser { get; set; }
Property Value
Type Description
long?
View Source

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. Note that this field cannot be set when spec.os.name is windows.

Declaration
[JsonPropertyName("seLinuxOptions")]
public V1SELinuxOptions SeLinuxOptions { get; set; }
Property Value
Type Description
V1SELinuxOptions
View Source

SeccompProfile

The seccomp options to use by this container. If seccomp options are provided at both the pod & container level, the container options override the pod options. Note that this field cannot be set when spec.os.name is windows.

Declaration
[JsonPropertyName("seccompProfile")]
public V1SeccompProfile SeccompProfile { get; set; }
Property Value
Type Description
V1SeccompProfile
View Source

WindowsOptions

The Windows specific settings applied to all containers. If unspecified, the options from the PodSecurityContext will be used. 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 linux.

Declaration
[JsonPropertyName("windowsOptions")]
public V1WindowsSecurityContextOptions WindowsOptions { get; set; }
Property Value
Type Description
V1WindowsSecurityContextOptions

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(V1SecurityContext?)

Declaration
public virtual bool Equals(V1SecurityContext? other)
Parameters
Type Name Description
V1SecurityContext 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 ==(V1SecurityContext?, V1SecurityContext?)

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

operator !=(V1SecurityContext?, V1SecurityContext?)

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

Implements

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