cdk8s-plus-30 (Python) ¶
Constructs ¶
AbstractPod ¶
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.AbstractPod(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
Methods ¶
add_container
¶
def add_container(
args: typing.List[str] = None,
command: typing.List[str] = None,
env_from: typing.List[EnvFrom] = None,
env_variables: typing.Mapping[EnvValue] = None,
image_pull_policy: ImagePullPolicy = None,
lifecycle: ContainerLifecycle = None,
liveness: Probe = None,
name: str = None,
port: typing.Union[int, float] = None,
port_number: typing.Union[int, float] = None,
ports: typing.List[ContainerPort] = None,
readiness: Probe = None,
resources: ContainerResources = None,
restart_policy: ContainerRestartPolicy = None,
security_context: ContainerSecurityContextProps = None,
startup: Probe = None,
volume_mounts: typing.List[VolumeMount] = None,
working_dir: str = None,
image: str
)
args
Optional ¶
- Type: typing.List[
str
] - Default: []
Arguments to the entrypoint. The docker image’s CMD is used if command
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.
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
command
Optional ¶
- Type: typing.List[
str
] - Default: The docker image’s ENTRYPOINT.
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
env_from
Optional ¶
- Type: typing.List[
cdk8s_plus_30.EnvFrom
] - Default: No sources.
List of sources to populate environment variables in the container.
When a key exists in multiple sources, the value associated with
the last source will take precedence. Values defined by the envVariables
property
with a duplicate key will take precedence.
env_variables
Optional ¶
- Type: typing.Mapping[
cdk8s_plus_30.EnvValue
] - Default: No environment variables.
Environment variables to set in the container.
image_pull_policy
Optional ¶
- Type:
cdk8s_plus_30.ImagePullPolicy
- Default: ImagePullPolicy.ALWAYS
Image pull policy for this container.
lifecycle
Optional ¶
Describes actions that the management system should take in response to container lifecycle events.
liveness
Optional ¶
- Type:
cdk8s_plus_30.Probe
- Default: no liveness probe is defined
Periodic probe of container liveness.
Container will be restarted if the probe fails.
name
Optional ¶
- Type:
str
- Default: ‘main’
Name of the container specified as a DNS_LABEL.
Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.
~~port
~~Optional ¶
-
Deprecated: - use
portNumber
. -
Type:
typing.Union[int, float]
port_number
Optional ¶
- Type:
typing.Union[int, float]
- Default: Only the ports mentiond in the
ports
property are exposed.
Number of port to expose on the pod’s IP address.
This must be a valid port number, 0 < x < 65536.
This is a convinience property if all you need a single TCP numbered port.
In case more advanced configuartion is required, use the ports
property.
This port is added to the list of ports mentioned in the ports
property.
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerPort
] - Default: Only the port mentioned in the
portNumber
property is exposed.
List of ports to expose from this container.
readiness
Optional ¶
- Type:
cdk8s_plus_30.Probe
- Default: no readiness probe is defined
Determines when the container is ready to serve traffic.
resources
Optional ¶
- Type:
cdk8s_plus_30.ContainerResources
- Default: cpu: request: 1000 millis limit: 1500 millis memory: request: 512 mebibytes limit: 2048 mebibytes
Compute resources (CPU and memory requests and limits) required by the container.
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.ContainerRestartPolicy
- Default: no restart policy is defined and the pod restart policy is applied
Kubelet will start init containers with restartPolicy=Always in the order with other init containers, but instead of waiting for its completion, it will wait for the container startup completion Currently, only accepted value is Always.
https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
security_context
Optional ¶
- Type:
cdk8s_plus_30.ContainerSecurityContextProps
- Default: ensureNonRoot: true privileged: false readOnlyRootFilesystem: true allowPrivilegeEscalation: false user: 25000 group: 26000
SecurityContext defines the security options the container should be run with.
If set, the fields override equivalent fields of the pod’s security context.
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
startup
Optional ¶
- Type:
cdk8s_plus_30.Probe
- Default: If a port is provided, then knocks on that port to determine when the container is ready for readiness and liveness probe checks. Otherwise, no startup probe is defined.
StartupProbe indicates that the Pod has successfully initialized.
If specified, no other probes are executed until this completes successfully
volume_mounts
Optional ¶
- Type: typing.List[
cdk8s_plus_30.VolumeMount
]
Pod volumes to mount into the container’s filesystem.
Cannot be updated.
working_dir
Optional ¶
- Type:
str
- Default: The container runtime’s default.
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.
image
Required ¶
- Type:
str
Docker image name.
add_host_alias
¶
def add_host_alias(
hostnames: typing.List[str],
ip: str
)
hostnames
Required ¶
- Type: typing.List[
str
]
Hostnames for the chosen IP address.
ip
Required ¶
- Type:
str
IP address of the host file entry.
add_init_container
¶
def add_init_container(
args: typing.List[str] = None,
command: typing.List[str] = None,
env_from: typing.List[EnvFrom] = None,
env_variables: typing.Mapping[EnvValue] = None,
image_pull_policy: ImagePullPolicy = None,
lifecycle: ContainerLifecycle = None,
liveness: Probe = None,
name: str = None,
port: typing.Union[int, float] = None,
port_number: typing.Union[int, float] = None,
ports: typing.List[ContainerPort] = None,
readiness: Probe = None,
resources: ContainerResources = None,
restart_policy: ContainerRestartPolicy = None,
security_context: ContainerSecurityContextProps = None,
startup: Probe = None,
volume_mounts: typing.List[VolumeMount] = None,
working_dir: str = None,
image: str
)
args
Optional ¶
- Type: typing.List[
str
] - Default: []
Arguments to the entrypoint. The docker image’s CMD is used if command
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.
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
command
Optional ¶
- Type: typing.List[
str
] - Default: The docker image’s ENTRYPOINT.
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
env_from
Optional ¶
- Type: typing.List[
cdk8s_plus_30.EnvFrom
] - Default: No sources.
List of sources to populate environment variables in the container.
When a key exists in multiple sources, the value associated with
the last source will take precedence. Values defined by the envVariables
property
with a duplicate key will take precedence.
env_variables
Optional ¶
- Type: typing.Mapping[
cdk8s_plus_30.EnvValue
] - Default: No environment variables.
Environment variables to set in the container.
image_pull_policy
Optional ¶
- Type:
cdk8s_plus_30.ImagePullPolicy
- Default: ImagePullPolicy.ALWAYS
Image pull policy for this container.
lifecycle
Optional ¶
Describes actions that the management system should take in response to container lifecycle events.
liveness
Optional ¶
- Type:
cdk8s_plus_30.Probe
- Default: no liveness probe is defined
Periodic probe of container liveness.
Container will be restarted if the probe fails.
name
Optional ¶
- Type:
str
- Default: ‘main’
Name of the container specified as a DNS_LABEL.
Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.
~~port
~~Optional ¶
-
Deprecated: - use
portNumber
. -
Type:
typing.Union[int, float]
port_number
Optional ¶
- Type:
typing.Union[int, float]
- Default: Only the ports mentiond in the
ports
property are exposed.
Number of port to expose on the pod’s IP address.
This must be a valid port number, 0 < x < 65536.
This is a convinience property if all you need a single TCP numbered port.
In case more advanced configuartion is required, use the ports
property.
This port is added to the list of ports mentioned in the ports
property.
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerPort
] - Default: Only the port mentioned in the
portNumber
property is exposed.
List of ports to expose from this container.
readiness
Optional ¶
- Type:
cdk8s_plus_30.Probe
- Default: no readiness probe is defined
Determines when the container is ready to serve traffic.
resources
Optional ¶
- Type:
cdk8s_plus_30.ContainerResources
- Default: cpu: request: 1000 millis limit: 1500 millis memory: request: 512 mebibytes limit: 2048 mebibytes
Compute resources (CPU and memory requests and limits) required by the container.
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.ContainerRestartPolicy
- Default: no restart policy is defined and the pod restart policy is applied
Kubelet will start init containers with restartPolicy=Always in the order with other init containers, but instead of waiting for its completion, it will wait for the container startup completion Currently, only accepted value is Always.
https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
security_context
Optional ¶
- Type:
cdk8s_plus_30.ContainerSecurityContextProps
- Default: ensureNonRoot: true privileged: false readOnlyRootFilesystem: true allowPrivilegeEscalation: false user: 25000 group: 26000
SecurityContext defines the security options the container should be run with.
If set, the fields override equivalent fields of the pod’s security context.
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
startup
Optional ¶
- Type:
cdk8s_plus_30.Probe
- Default: If a port is provided, then knocks on that port to determine when the container is ready for readiness and liveness probe checks. Otherwise, no startup probe is defined.
StartupProbe indicates that the Pod has successfully initialized.
If specified, no other probes are executed until this completes successfully
volume_mounts
Optional ¶
- Type: typing.List[
cdk8s_plus_30.VolumeMount
]
Pod volumes to mount into the container’s filesystem.
Cannot be updated.
working_dir
Optional ¶
- Type:
str
- Default: The container runtime’s default.
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.
image
Required ¶
- Type:
str
Docker image name.
add_volume
¶
def add_volume(
vol: Volume
)
vol
Required ¶
- Type:
cdk8s_plus_30.Volume
attach_container
¶
def attach_container(
cont: Container
)
cont
Required ¶
- Type:
cdk8s_plus_30.Container
to_network_policy_peer_config
¶
def to_network_policy_peer_config()
to_pod_selector
¶
def to_pod_selector()
to_pod_selector_config
¶
def to_pod_selector_config()
to_subject_configuration
¶
def to_subject_configuration()
Properties ¶
automount_service_account_token
Required ¶
automount_service_account_token: bool
- Type:
bool
containers
Required ¶
containers: typing.List[Container]
- Type: typing.List[
cdk8s_plus_30.Container
]
dns
Required ¶
dns: PodDns
- Type:
cdk8s_plus_30.PodDns
host_aliases
Required ¶
host_aliases: typing.List[HostAlias]
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
init_containers
Required ¶
init_containers: typing.List[Container]
- Type: typing.List[
cdk8s_plus_30.Container
]
pod_metadata
Required ¶
pod_metadata: ApiObjectMetadataDefinition
security_context
Required ¶
security_context: PodSecurityContext
volumes
Required ¶
volumes: typing.List[Volume]
- Type: typing.List[
cdk8s_plus_30.Volume
]
docker_registry_auth
Optional ¶
docker_registry_auth: ISecret
- Type:
cdk8s_plus_30.ISecret
host_network
Optional ¶
host_network: bool
- Type:
bool
restart_policy
Optional ¶
restart_policy: RestartPolicy
service_account
Optional ¶
service_account: IServiceAccount
termination_grace_period
Optional ¶
termination_grace_period: Duration
- Type:
cdk8s.Duration
AwsElasticBlockStorePersistentVolume ¶
Represents an AWS Disk resource that is attached to a kubelet’s host machine and then exposed to the pod.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.AwsElasticBlockStorePersistentVolume(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
claim: IPersistentVolumeClaim = None,
mount_options: typing.List[str] = None,
reclaim_policy: PersistentVolumeReclaimPolicy = None,
storage: Size = None,
storage_class_name: str = None,
volume_mode: PersistentVolumeMode = None,
volume_id: str,
fs_type: str = None,
partition: typing.Union[int, float] = None,
read_only: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes.
Contains all ways the volume can be mounted.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes
claim
Optional ¶
- Type:
cdk8s_plus_30.IPersistentVolumeClaim
- Default: Not bound to a specific claim.
Part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
Expected to be non-nil when bound.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding
mount_options
Optional ¶
- Type: typing.List[
str
] - Default: No options.
A list of mount options, e.g. [“ro”, “soft”]. Not validated - mount will simply fail if one is invalid.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
reclaim_policy
Optional ¶
- Type:
cdk8s_plus_30.PersistentVolumeReclaimPolicy
- Default: PersistentVolumeReclaimPolicy.RETAIN
When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource.
The reclaim policy tells the cluster what to do with the volume after it has been released of its claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming
storage
Optional ¶
- Type:
cdk8s.Size
- Default: No specified.
What is the storage capacity of this volume.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
- Type:
str
- Default: Volume does not belong to any storage class.
Name of StorageClass to which this persistent volume belongs.
volume_mode
Optional ¶
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
volume_id
Required ¶
- Type:
str
Unique ID of the persistent disk resource in AWS (Amazon EBS volume).
More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
fs_type
Optional ¶
- Type:
str
- Default: ‘ext4’
Filesystem type of the volume that you want to mount.
Tip: Ensure that the filesystem type is supported by the host operating system.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
partition
Optional ¶
- Type:
typing.Union[int, float]
- Default: No partition.
The partition in the volume that you want to mount.
If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as “1”. Similarly, the volume partition for /dev/sda is “0” (or you can leave the property empty).
read_only
Optional ¶
- Type:
bool
- Default: false
Specify “true” to force and set the ReadOnly property in VolumeMounts to “true”.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
Properties ¶
fs_type
Required ¶
fs_type: str
- Type:
str
File system type of this volume.
read_only
Required ¶
read_only: bool
- Type:
bool
Whether or not it is mounted as a read-only volume.
volume_id
Required ¶
volume_id: str
- Type:
str
Volume id of this volume.
partition
Optional ¶
partition: typing.Union[int, float]
- Type:
typing.Union[int, float]
Partition of this volume.
AzureDiskPersistentVolume ¶
AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.AzureDiskPersistentVolume(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
claim: IPersistentVolumeClaim = None,
mount_options: typing.List[str] = None,
reclaim_policy: PersistentVolumeReclaimPolicy = None,
storage: Size = None,
storage_class_name: str = None,
volume_mode: PersistentVolumeMode = None,
disk_name: str,
disk_uri: str,
caching_mode: AzureDiskPersistentVolumeCachingMode = None,
fs_type: str = None,
kind: AzureDiskPersistentVolumeKind = None,
read_only: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes.
Contains all ways the volume can be mounted.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes
claim
Optional ¶
- Type:
cdk8s_plus_30.IPersistentVolumeClaim
- Default: Not bound to a specific claim.
Part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
Expected to be non-nil when bound.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding
mount_options
Optional ¶
- Type: typing.List[
str
] - Default: No options.
A list of mount options, e.g. [“ro”, “soft”]. Not validated - mount will simply fail if one is invalid.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
reclaim_policy
Optional ¶
- Type:
cdk8s_plus_30.PersistentVolumeReclaimPolicy
- Default: PersistentVolumeReclaimPolicy.RETAIN
When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource.
The reclaim policy tells the cluster what to do with the volume after it has been released of its claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming
storage
Optional ¶
- Type:
cdk8s.Size
- Default: No specified.
What is the storage capacity of this volume.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
- Type:
str
- Default: Volume does not belong to any storage class.
Name of StorageClass to which this persistent volume belongs.
volume_mode
Optional ¶
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
disk_name
Required ¶
- Type:
str
The Name of the data disk in the blob storage.
disk_uri
Required ¶
- Type:
str
The URI the data disk in the blob storage.
caching_mode
Optional ¶
- Type:
cdk8s_plus_30.AzureDiskPersistentVolumeCachingMode
- Default: AzureDiskPersistentVolumeCachingMode.NONE.
Host Caching mode.
fs_type
Optional ¶
- Type:
str
- Default: ‘ext4’
Filesystem type to mount.
Must be a filesystem type supported by the host operating system.
kind
Optional ¶
- Type:
cdk8s_plus_30.AzureDiskPersistentVolumeKind
- Default: AzureDiskPersistentVolumeKind.SHARED
Kind of disk.
read_only
Optional ¶
- Type:
bool
- Default: false
Force the ReadOnly setting in VolumeMounts.
Properties ¶
azure_kind
Required ¶
azure_kind: AzureDiskPersistentVolumeKind
Azure kind of this volume.
caching_mode
Required ¶
caching_mode: AzureDiskPersistentVolumeCachingMode
Caching mode of this volume.
disk_name
Required ¶
disk_name: str
- Type:
str
Disk name of this volume.
disk_uri
Required ¶
disk_uri: str
- Type:
str
Disk URI of this volume.
fs_type
Required ¶
fs_type: str
- Type:
str
File system type of this volume.
read_only
Required ¶
read_only: bool
- Type:
bool
Whether or not it is mounted as a read-only volume.
BasicAuthSecret ¶
Create a secret for basic authentication.
https://kubernetes.io/docs/concepts/configuration/secret/#basic-authentication-secret
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.BasicAuthSecret(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
immutable: bool = None,
password: str,
username: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
password
Required ¶
- Type:
str
The password or token for authentication.
username
Required ¶
- Type:
str
The user name for authentication.
ClusterRole ¶
- Implements:
cdk8s_plus_30.IClusterRole
,cdk8s_plus_30.IRole
ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.ClusterRole(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
aggregation_labels: typing.Mapping[str] = None,
rules: typing.List[ClusterRolePolicyRule] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
aggregation_labels
Optional ¶
- Type: typing.Mapping[
str
]
Specify labels that should be used to locate ClusterRoles, whose rules will be automatically filled into this ClusterRole’s rules.
rules
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ClusterRolePolicyRule
] - Default: []
A list of rules the role should allow.
Methods ¶
aggregate
¶
def aggregate(
key: str,
value: str
)
key
Required ¶
- Type:
str
value
Required ¶
- Type:
str
allow
¶
def allow(
verbs: typing.List[str],
endpoints: IApiEndpoint
)
verbs
Required ¶
- Type: typing.List[
str
]
endpoints
Required ¶
The endpoints(s) to apply to.
allow_create
¶
def allow_create(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
allow_delete
¶
def allow_delete(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
allow_delete_collection
¶
def allow_delete_collection(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
allow_get
¶
def allow_get(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
allow_list
¶
def allow_list(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
allow_patch
¶
def allow_patch(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
allow_read
¶
def allow_read(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
allow_read_write
¶
def allow_read_write(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
allow_update
¶
def allow_update(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
allow_watch
¶
def allow_watch(
endpoints: IApiEndpoint
)
endpoints
Required ¶
The resource(s) to apply to.
bind
¶
def bind(
subjects: ISubject
)
subjects
Required ¶
- Type:
cdk8s_plus_30.ISubject
a list of subjects to bind to.
bind_in_namespace
¶
def bind_in_namespace(
namespace: str,
subjects: ISubject
)
namespace
Required ¶
- Type:
str
the namespace to limit permissions to.
subjects
Required ¶
- Type:
cdk8s_plus_30.ISubject
a list of subjects to bind to.
combine
¶
def combine(
rol: ClusterRole
)
rol
Required ¶
Static Functions ¶
from_cluster_role_name
¶
import cdk8s_plus_30
cdk8s_plus_30.ClusterRole.from_cluster_role_name(
scope: Construct,
id: str,
name: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
Properties ¶
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
rules
Required ¶
rules: typing.List[ClusterRolePolicyRule]
- Type: typing.List[
cdk8s_plus_30.ClusterRolePolicyRule
]
Rules associaated with this Role.
Returns a copy, use allow
to add rules.
ClusterRoleBinding ¶
A ClusterRoleBinding grants permissions cluster-wide to a user or set of users.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.ClusterRoleBinding(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
role: IClusterRole
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
role
Required ¶
The role to bind to.
Methods ¶
add_subjects
¶
def add_subjects(
subjects: ISubject
)
subjects
Required ¶
- Type:
cdk8s_plus_30.ISubject
The subjects to add.
Properties ¶
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
role
Required ¶
role: IClusterRole
subjects
Required ¶
subjects: typing.List[ISubject]
- Type: typing.List[
cdk8s_plus_30.ISubject
]
ConfigMap ¶
- Implements:
cdk8s_plus_30.IConfigMap
ConfigMap holds configuration data for pods to consume.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.ConfigMap(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
binary_data: typing.Mapping[str] = None,
data: typing.Mapping[str] = None,
immutable: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
binary_data
Optional ¶
- Type: typing.Mapping[
str
]
BinaryData contains the binary data.
Each key must consist of alphanumeric characters, ‘-‘, ‘_’ or ‘.’. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process.
You can also add binary data using configMap.addBinaryData()
.
data
Optional ¶
- Type: typing.Mapping[
str
]
Data contains the configuration data.
Each key must consist of alphanumeric characters, ‘-‘, ‘_’ or ‘.’. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process.
You can also add data using configMap.addData()
.
immutable
Optional ¶
- Type:
bool
- Default: false
If set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
Methods ¶
add_binary_data
¶
def add_binary_data(
key: str,
value: str
)
key
Required ¶
- Type:
str
The key.
value
Required ¶
- Type:
str
The value.
add_data
¶
def add_data(
key: str,
value: str
)
key
Required ¶
- Type:
str
The key.
value
Required ¶
- Type:
str
The value.
add_directory
¶
def add_directory(
local_dir: str,
exclude: typing.List[str] = None,
key_prefix: str = None
)
local_dir
Required ¶
- Type:
str
A path to a local directory.
exclude
Optional ¶
- Type: typing.List[
str
] - Default: include all files
Glob patterns to exclude when adding files.
key_prefix
Optional ¶
- Type:
str
- Default: “”
A prefix to add to all keys in the config map.
add_file
¶
def add_file(
local_file: str,
key: str = None
)
local_file
Required ¶
- Type:
str
The path to the local file.
key
Optional ¶
- Type:
str
The ConfigMap key (default to the file name).
Static Functions ¶
from_config_map_name
¶
import cdk8s_plus_30
cdk8s_plus_30.ConfigMap.from_config_map_name(
scope: Construct,
id: str,
name: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
Properties ¶
binary_data
Required ¶
binary_data: typing.Mapping[str]
- Type: typing.Mapping[
str
]
The binary data associated with this config map.
Returns a copy. To add data records, use addBinaryData()
or addData()
.
data
Required ¶
data: typing.Mapping[str]
- Type: typing.Mapping[
str
]
The data associated with this config map.
Returns an copy. To add data records, use addData()
or addBinaryData()
.
immutable
Required ¶
immutable: bool
- Type:
bool
Whether or not this config map is immutable.
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
CronJob ¶
A CronJob is responsible for creating a Job and scheduling it based on provided cron schedule.
This helps running Jobs in a recurring manner.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.CronJob(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
active_deadline: Duration = None,
backoff_limit: typing.Union[int, float] = None,
ttl_after_finished: Duration = None,
schedule: Cron,
concurrency_policy: ConcurrencyPolicy = None,
failed_jobs_retained: typing.Union[int, float] = None,
starting_deadline: Duration = None,
successful_jobs_retained: typing.Union[int, float] = None,
suspend: bool = None,
time_zone: str = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
active_deadline
Optional ¶
- Type:
cdk8s.Duration
- Default: If unset, then there is no deadline.
Specifies the duration the job may be active before the system tries to terminate it.
backoff_limit
Optional ¶
- Type:
typing.Union[int, float]
- Default: If not set, system defaults to 6.
Specifies the number of retries before marking this job failed.
ttl_after_finished
Optional ¶
- Type:
cdk8s.Duration
- Default: If this field is unset, the Job won’t be automatically deleted.
Limits the lifetime of a Job that has finished execution (either Complete or Failed).
If this field is set, after the Job finishes, it is eligible to
be automatically deleted. When the Job is being deleted, its lifecycle
guarantees (e.g. finalizers) will be honored. If this field is set to zero,
the Job becomes eligible to be deleted immediately after it finishes. This
field is alpha-level and is only honored by servers that enable the
TTLAfterFinished
feature.
schedule
Required ¶
- Type:
cdk8s.Cron
Specifies the time in which the job would run again.
This is defined as a cron expression in the CronJob resource.
concurrency_policy
Optional ¶
- Type:
cdk8s_plus_30.ConcurrencyPolicy
- Default: ConcurrencyPolicy.Forbid
Specifies the concurrency policy for the job.
failed_jobs_retained
Optional ¶
- Type:
typing.Union[int, float]
- Default: 1
Specifies the number of failed jobs history retained.
This would retain the Job and the associated Pod resource and can be useful for debugging.
starting_deadline
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(10)
Kubernetes attempts to start cron jobs at its schedule time, but this is not guaranteed.
This deadline specifies how much time can pass after a schedule point, for which kubernetes can still start the job. For example, if this is set to 100 seconds, kubernetes is allowed to start the job at a maximum 100 seconds after the scheduled time.
Note that the Kubernetes CronJobController checks for things every 10 seconds, for this reason, a deadline below 10 seconds is not allowed, as it may cause your job to never be scheduled.
In addition, kubernetes will stop scheduling jobs if more than 100 schedules were missed (for any reason). This property also controls what time interval should kubernetes consider when counting for missed schedules.
For example, suppose a CronJob is set to schedule a new Job every one minute beginning at 08:30:00,
and its startingDeadline
field is not set. If the CronJob controller happens to be down from 08:29:00 to 10:21:00,
the job will not start as the number of missed jobs which missed their schedule is greater than 100.
However, if startingDeadline
is set to 200 seconds, kubernetes will only count 3 missed schedules, and thus
start a new execution at 10:22:00.
successful_jobs_retained
Optional ¶
- Type:
typing.Union[int, float]
- Default: 3
Specifies the number of successful jobs history retained.
This would retain the Job and the associated Pod resource and can be useful for debugging.
suspend
Optional ¶
- Type:
bool
- Default: false
Specifies if the cron job should be suspended.
Only applies to future executions, current ones are remained untouched.
time_zone
Optional ¶
- Type:
str
- Default: Timezone of kube-controller-manager process.
Specifies the timezone for the job.
This helps aligining the schedule to follow the specified timezone.
{@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones} for list of valid timezone values.
Properties ¶
concurrency_policy
Required ¶
concurrency_policy: str
- Type:
str
The policy used by this cron job to determine the concurrency mode in which to schedule jobs.
failed_jobs_retained
Required ¶
failed_jobs_retained: typing.Union[int, float]
- Type:
typing.Union[int, float]
The number of failed jobs retained by this cron job.
resource_type
Required ¶
resource_type: str
- Type:
str
Represents the resource type.
schedule
Required ¶
schedule: Cron
- Type:
cdk8s.Cron
The schedule this cron job is scheduled to run in.
starting_deadline
Required ¶
starting_deadline: Duration
- Type:
cdk8s.Duration
The time by which the running cron job needs to schedule the next job execution.
The job is considered as failed if it misses this deadline.
successful_jobs_retained
Required ¶
successful_jobs_retained: typing.Union[int, float]
- Type:
typing.Union[int, float]
The number of successful jobs retained by this cron job.
suspend
Required ¶
suspend: bool
- Type:
bool
Whether or not the cron job is currently suspended or not.
time_zone
Optional ¶
time_zone: str
- Type:
str
The timezone which this cron job would follow to schedule jobs.
DaemonSet ¶
A DaemonSet ensures that all (or some) Nodes run a copy of a Pod.
As nodes are added to the cluster, Pods are added to them. As nodes are removed from the cluster, those Pods are garbage collected. Deleting a DaemonSet will clean up the Pods it created.
Some typical uses of a DaemonSet are:
- running a cluster storage daemon on every node
- running a logs collection daemon on every node
- running a node monitoring daemon on every node
In a simple case, one DaemonSet, covering all nodes, would be used for each type of daemon. A more complex setup might use multiple DaemonSets for a single type of daemon, but with different flags and/or different memory and cpu requests for different hardware types.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.DaemonSet(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
min_ready_seconds: typing.Union[int, float] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
min_ready_seconds
Optional ¶
- Type:
typing.Union[int, float]
- Default: 0
Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
Properties ¶
min_ready_seconds
Required ¶
min_ready_seconds: typing.Union[int, float]
- Type:
typing.Union[int, float]
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
Deployment ¶
- Implements:
cdk8s_plus_30.IScalable
A Deployment provides declarative updates for Pods and ReplicaSets.
You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove existing Deployments and adopt all their resources with new Deployments.
Note: Do not manage ReplicaSets owned by a Deployment. Consider opening an issue in the main Kubernetes repository if your use case is not covered below.
Use Case
The following are typical use cases for Deployments:
- Create a Deployment to rollout a ReplicaSet. The ReplicaSet creates Pods in the background. Check the status of the rollout to see if it succeeds or not.
- Declare the new state of the Pods by updating the PodTemplateSpec of the Deployment. A new ReplicaSet is created and the Deployment manages moving the Pods from the old ReplicaSet to the new one at a controlled rate. Each new ReplicaSet updates the revision of the Deployment.
- Rollback to an earlier Deployment revision if the current state of the Deployment is not stable. Each rollback updates the revision of the Deployment.
- Scale up the Deployment to facilitate more load.
- Pause the Deployment to apply multiple fixes to its PodTemplateSpec and then resume it to start a new rollout.
- Use the status of the Deployment as an indicator that a rollout has stuck.
- Clean up older ReplicaSets that you don’t need anymore.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Deployment(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
min_ready: Duration = None,
progress_deadline: Duration = None,
replicas: typing.Union[int, float] = None,
strategy: DeploymentStrategy = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
min_ready
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(0)
Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
Zero means the pod will be considered available as soon as it is ready.
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#min-ready-seconds
progress_deadline
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(600)
The maximum duration for a deployment to make progress before it is considered to be failed.
The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status.
Note that progress will not be estimated during the time a deployment is paused.
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#progress-deadline-seconds
replicas
Optional ¶
- Type:
typing.Union[int, float]
- Default: 2
Number of desired pods.
strategy
Optional ¶
- Type:
cdk8s_plus_30.DeploymentStrategy
- Default: RollingUpdate with maxSurge and maxUnavailable set to 25%.
Specifies the strategy used to replace old Pods by new ones.
Methods ¶
expose_via_ingress
¶
def expose_via_ingress(
path: str,
name: str = None,
ports: typing.List[ServicePort] = None,
service_type: ServiceType = None,
ingress: Ingress = None,
path_type: HttpIngressPathType = None
)
path
Required ¶
- Type:
str
The ingress path to register under.
name
Optional ¶
- Type:
str
- Default: auto generated.
The name of the service to expose.
If you’d like to expose the deployment multiple times, you must explicitly set a name starting from the second expose call.
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ServicePort
] - Default: extracted from the deployment.
The ports that the service should bind to.
service_type
Optional ¶
- Type:
cdk8s_plus_30.ServiceType
- Default: ClusterIP.
The type of the exposed service.
ingress
Optional ¶
- Type:
cdk8s_plus_30.Ingress
- Default: An ingress will be automatically created.
The ingress to add rules to.
path_type
Optional ¶
- Type:
cdk8s_plus_30.HttpIngressPathType
- Default: HttpIngressPathType.PREFIX
The type of the path.
expose_via_service
¶
def expose_via_service(
name: str = None,
ports: typing.List[ServicePort] = None,
service_type: ServiceType = None
)
name
Optional ¶
- Type:
str
- Default: auto generated.
The name of the service to expose.
If you’d like to expose the deployment multiple times, you must explicitly set a name starting from the second expose call.
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ServicePort
] - Default: extracted from the deployment.
The ports that the service should bind to.
service_type
Optional ¶
- Type:
cdk8s_plus_30.ServiceType
- Default: ClusterIP.
The type of the exposed service.
mark_has_autoscaler
¶
def mark_has_autoscaler()
to_scaling_target
¶
def to_scaling_target()
Properties ¶
min_ready
Required ¶
min_ready: Duration
- Type:
cdk8s.Duration
Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
progress_deadline
Required ¶
progress_deadline: Duration
- Type:
cdk8s.Duration
The maximum duration for a deployment to make progress before it is considered to be failed.
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
strategy
Required ¶
strategy: DeploymentStrategy
replicas
Optional ¶
replicas: typing.Union[int, float]
- Type:
typing.Union[int, float]
Number of desired pods.
has_autoscaler
Required ¶
has_autoscaler: bool
- Type:
bool
If this is a target of an autoscaler.
DockerConfigSecret ¶
Create a secret for storing credentials for accessing a container image registry.
https://kubernetes.io/docs/concepts/configuration/secret/#docker-config-secrets
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.DockerConfigSecret(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
immutable: bool = None,
data: typing.Mapping[typing.Any]
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
data
Required ¶
- Type: typing.Mapping[
typing.Any
]
JSON content to provide for the ~/.docker/config.json
file. This will be stringified and inserted as stringData.
https://docs.docker.com/engine/reference/commandline/cli/#sample-configuration-file
GCEPersistentDiskPersistentVolume ¶
GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet’s host machine and then exposed to the pod.
Provisioned by an admin.
https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.GCEPersistentDiskPersistentVolume(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
claim: IPersistentVolumeClaim = None,
mount_options: typing.List[str] = None,
reclaim_policy: PersistentVolumeReclaimPolicy = None,
storage: Size = None,
storage_class_name: str = None,
volume_mode: PersistentVolumeMode = None,
pd_name: str,
fs_type: str = None,
partition: typing.Union[int, float] = None,
read_only: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes.
Contains all ways the volume can be mounted.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes
claim
Optional ¶
- Type:
cdk8s_plus_30.IPersistentVolumeClaim
- Default: Not bound to a specific claim.
Part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
Expected to be non-nil when bound.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding
mount_options
Optional ¶
- Type: typing.List[
str
] - Default: No options.
A list of mount options, e.g. [“ro”, “soft”]. Not validated - mount will simply fail if one is invalid.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
reclaim_policy
Optional ¶
- Type:
cdk8s_plus_30.PersistentVolumeReclaimPolicy
- Default: PersistentVolumeReclaimPolicy.RETAIN
When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource.
The reclaim policy tells the cluster what to do with the volume after it has been released of its claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming
storage
Optional ¶
- Type:
cdk8s.Size
- Default: No specified.
What is the storage capacity of this volume.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
- Type:
str
- Default: Volume does not belong to any storage class.
Name of StorageClass to which this persistent volume belongs.
volume_mode
Optional ¶
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
pd_name
Required ¶
- Type:
str
Unique name of the PD resource in GCE.
Used to identify the disk in GCE.
https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk
fs_type
Optional ¶
- Type:
str
- Default: ‘ext4’
Filesystem type of the volume that you want to mount.
Tip: Ensure that the filesystem type is supported by the host operating system.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
partition
Optional ¶
- Type:
typing.Union[int, float]
- Default: No partition.
The partition in the volume that you want to mount.
If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as “1”. Similarly, the volume partition for /dev/sda is “0” (or you can leave the property empty).
read_only
Optional ¶
- Type:
bool
- Default: false
Specify “true” to force and set the ReadOnly property in VolumeMounts to “true”.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
Properties ¶
fs_type
Required ¶
fs_type: str
- Type:
str
File system type of this volume.
pd_name
Required ¶
pd_name: str
- Type:
str
PD resource in GCE of this volume.
read_only
Required ¶
read_only: bool
- Type:
bool
Whether or not it is mounted as a read-only volume.
partition
Optional ¶
partition: typing.Union[int, float]
- Type:
typing.Union[int, float]
Partition of this volume.
Group ¶
- Implements:
cdk8s_plus_30.ISubject
Represents a group.
Methods ¶
to_subject_configuration
¶
def to_subject_configuration()
Static Functions ¶
from_name
¶
import cdk8s_plus_30
cdk8s_plus_30.Group.from_name(
scope: Construct,
id: str,
name: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
Properties ¶
kind
Required ¶
kind: str
- Type:
str
name
Required ¶
name: str
- Type:
str
api_group
Optional ¶
api_group: str
- Type:
str
HorizontalPodAutoscaler ¶
A HorizontalPodAutoscaler scales a workload up or down in response to a metric change.
This allows your services to scale up when demand is high and scale down when they are no longer needed.
Typical use cases for HorizontalPodAutoscaler:
- When Memory usage is above 70%, scale up the number of replicas to meet the demand.
- When CPU usage is below 30%, scale down the number of replicas to save resources.
- When a service is experiencing a spike in traffic, scale up the number of replicas to meet the demand. Then, when the traffic subsides, scale down the number of replicas to save resources.
The autoscaler uses the following algorithm to determine the number of replicas to scale:
desiredReplicas = ceil[currentReplicas * ( currentMetricValue / desiredMetricValue )]
HorizontalPodAutoscaler’s can be used to with any Scalable
workload:
- Deployment
- StatefulSet
Targets that already have a replica count defined:
Remove any replica counts from the target resource before associating with a HorizontalPodAutoscaler. If this isn’t done, then any time a change to that object is applied, Kubernetes will scale the current number of Pods to the value of the target.replicas key. This may not be desired and could lead to unexpected behavior.
https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#implicit-maintenance-mode-deactivation
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.HorizontalPodAutoscaler(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
max_replicas: typing.Union[int, float],
target: IScalable,
metrics: typing.List[Metric] = None,
min_replicas: typing.Union[int, float] = None,
scale_down: ScalingRules = None,
scale_up: ScalingRules = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
max_replicas
Required ¶
- Type:
typing.Union[int, float]
The maximum number of replicas that can be scaled up to.
target
Required ¶
- Type:
cdk8s_plus_30.IScalable
The workload to scale up or down.
Scalable workload types:
- Deployment
- StatefulSet
metrics
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Metric
] - Default: If metrics are not provided, then the target resource constraints (e.g. cpu limit) will be used as scaling metrics.
The metric conditions that trigger a scale up or scale down.
min_replicas
Optional ¶
- Type:
typing.Union[int, float]
- Default: 1
The minimum number of replicas that can be scaled down to.
Can be set to 0 if the alpha feature gate HPAScaleToZero
is enabled and
at least one Object or External metric is configured.
scale_down
Optional ¶
- Type:
cdk8s_plus_30.ScalingRules
- Default: Scale down to minReplica count with a 5 minute stabilization window.
The scaling behavior when scaling down.
scale_up
Optional ¶
- Type:
cdk8s_plus_30.ScalingRules
- Default: Is the higher of:
- Increase no more than 4 pods per 60 seconds
- Double the number of pods per 60 seconds
The scaling behavior when scaling up.
Properties ¶
max_replicas
Required ¶
max_replicas: typing.Union[int, float]
- Type:
typing.Union[int, float]
The maximum number of replicas that can be scaled up to.
min_replicas
Required ¶
min_replicas: typing.Union[int, float]
- Type:
typing.Union[int, float]
The minimum number of replicas that can be scaled down to.
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
scale_down
Required ¶
scale_down: ScalingRules
The scaling behavior when scaling down.
scale_up
Required ¶
scale_up: ScalingRules
The scaling behavior when scaling up.
target
Required ¶
target: IScalable
- Type:
cdk8s_plus_30.IScalable
The workload to scale up or down.
metrics
Optional ¶
metrics: typing.List[Metric]
- Type: typing.List[
cdk8s_plus_30.Metric
]
The metric conditions that trigger a scale up or scale down.
Ingress ¶
Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend.
An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Ingress(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
class_name: str = None,
default_backend: IngressBackend = None,
rules: typing.List[IngressRule] = None,
tls: typing.List[IngressTls] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
class_name
Optional ¶
- Type:
str
Class Name for this ingress.
This field is a reference to an IngressClass resource that contains additional Ingress configuration, including the name of the Ingress controller.
default_backend
Optional ¶
The default backend services requests that do not match any rule.
Using this option or the addDefaultBackend()
method is equivalent to
adding a rule with both path
and host
undefined.
rules
Optional ¶
- Type: typing.List[
cdk8s_plus_30.IngressRule
]
Routing rules for this ingress.
Each rule must define an IngressBackend
that will receive the requests
that match this rule. If both host
and path
are not specifiec, this
backend will be used as the default backend of the ingress.
You can also add rules later using addRule()
, addHostRule()
,
addDefaultBackend()
and addHostDefaultBackend()
.
tls
Optional ¶
- Type: typing.List[
cdk8s_plus_30.IngressTls
]
TLS settings for this ingress.
Using this option tells the ingress controller to expose a TLS endpoint. Currently the Ingress only supports a single TLS port, 443. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension, if the ingress controller fulfilling the ingress supports SNI.
Methods ¶
add_default_backend
¶
def add_default_backend(
backend: IngressBackend
)
backend
Required ¶
The backend to use for requests that do not match any rule.
add_host_default_backend
¶
def add_host_default_backend(
host: str,
backend: IngressBackend
)
host
Required ¶
- Type:
str
The host name to match.
backend
Required ¶
The backend to route to.
add_host_rule
¶
def add_host_rule(
host: str,
path: str,
backend: IngressBackend,
path_type: HttpIngressPathType = None
)
host
Required ¶
- Type:
str
The host name.
path
Required ¶
- Type:
str
The HTTP path.
backend
Required ¶
The backend to route requests to.
path_type
Optional ¶
How the path is matched against request paths.
add_rule
¶
def add_rule(
path: str,
backend: IngressBackend,
path_type: HttpIngressPathType = None
)
path
Required ¶
- Type:
str
The HTTP path.
backend
Required ¶
The backend to route requests to.
path_type
Optional ¶
How the path is matched against request paths.
add_rules
¶
def add_rules(
backend: IngressBackend,
host: str = None,
path: str = None,
path_type: HttpIngressPathType = None
)
backend
Required ¶
Backend defines the referenced service endpoint to which the traffic will be forwarded to.
host
Optional ¶
- Type:
str
- Default: If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue.
Host is the fully qualified domain name of a network host, as defined by RFC 3986.
Note the following deviations from the “host” part of the URI as
defined in the RFC: 1. IPs are not allowed. Currently an IngressRuleValue
can only apply to the IP in the Spec of the parent Ingress. 2. The :
delimiter is not respected because ports are not allowed. Currently the
port of an Ingress is implicitly :80 for http and :443 for https. Both
these may change in the future. Incoming requests are matched against the
host before the IngressRuleValue.
path
Optional ¶
- Type:
str
- Default: If unspecified, the path defaults to a catch all sending traffic to the backend.
Path is an extended POSIX regex as defined by IEEE Std 1003.1, (i.e this follows the egrep/unix syntax, not the perl syntax) matched against the path of an incoming request. Currently it can contain characters disallowed from the conventional “path” part of a URL as defined by RFC 3986. Paths must begin with a ‘/’.
path_type
Optional ¶
Specify how the path is matched against request paths.
By default, path types will be matched by prefix.
https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
add_tls
¶
def add_tls(
tls: typing.List[IngressTls]
)
tls
Required ¶
- Type: typing.List[
cdk8s_plus_30.IngressTls
]
Properties ¶
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
Job ¶
A Job creates one or more Pods and ensures that a specified number of them successfully terminate.
As pods successfully complete, the Job tracks the successful completions. When a specified number of successful completions is reached, the task (ie, Job) is complete. Deleting a Job will clean up the Pods it created. A simple case is to create one Job object in order to reliably run one Pod to completion. The Job object will start a new Pod if the first Pod fails or is deleted (for example due to a node hardware failure or a node reboot). You can also use a Job to run multiple Pods in parallel.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Job(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
active_deadline: Duration = None,
backoff_limit: typing.Union[int, float] = None,
ttl_after_finished: Duration = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
active_deadline
Optional ¶
- Type:
cdk8s.Duration
- Default: If unset, then there is no deadline.
Specifies the duration the job may be active before the system tries to terminate it.
backoff_limit
Optional ¶
- Type:
typing.Union[int, float]
- Default: If not set, system defaults to 6.
Specifies the number of retries before marking this job failed.
ttl_after_finished
Optional ¶
- Type:
cdk8s.Duration
- Default: If this field is unset, the Job won’t be automatically deleted.
Limits the lifetime of a Job that has finished execution (either Complete or Failed).
If this field is set, after the Job finishes, it is eligible to
be automatically deleted. When the Job is being deleted, its lifecycle
guarantees (e.g. finalizers) will be honored. If this field is set to zero,
the Job becomes eligible to be deleted immediately after it finishes. This
field is alpha-level and is only honored by servers that enable the
TTLAfterFinished
feature.
Properties ¶
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
active_deadline
Optional ¶
active_deadline: Duration
- Type:
cdk8s.Duration
Duration before job is terminated.
If undefined, there is no deadline.
backoff_limit
Optional ¶
backoff_limit: typing.Union[int, float]
- Type:
typing.Union[int, float]
Number of retries before marking failed.
ttl_after_finished
Optional ¶
ttl_after_finished: Duration
- Type:
cdk8s.Duration
TTL before the job is deleted after it is finished.
Namespace ¶
In Kubernetes, namespaces provides a mechanism for isolating groups of resources within a single cluster.
Names of resources need to be unique within a namespace, but not across namespaces. Namespace-based scoping is applicable only for namespaced objects (e.g. Deployments, Services, etc) and not for cluster-wide objects (e.g. StorageClass, Nodes, PersistentVolumes, etc).
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Namespace(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
Methods ¶
to_namespace_selector_config
¶
def to_namespace_selector_config()
to_network_policy_peer_config
¶
def to_network_policy_peer_config()
to_pod_selector
¶
def to_pod_selector()
Properties ¶
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
Constants ¶
NAME_LABEL
¶
- Type:
str
https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#automatic-labelling
Namespaces ¶
Represents a group of namespaces.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Namespaces(
scope: Construct,
id: str,
expressions: typing.List[LabelExpression] = None,
names: typing.List[str] = None,
labels: typing.Mapping[str] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
expressions
Optional ¶
- Type: typing.List[
cdk8s_plus_30.LabelExpression
]
names
Optional ¶
- Type: typing.List[
str
]
labels
Optional ¶
- Type: typing.Mapping[
str
]
Methods ¶
to_namespace_selector_config
¶
def to_namespace_selector_config()
to_network_policy_peer_config
¶
def to_network_policy_peer_config()
to_pod_selector
¶
def to_pod_selector()
Static Functions ¶
all
¶
import cdk8s_plus_30
cdk8s_plus_30.Namespaces.all(
scope: Construct,
id: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
select
¶
import cdk8s_plus_30
cdk8s_plus_30.Namespaces.select(
scope: Construct,
id: str,
expressions: typing.List[LabelExpression] = None,
labels: typing.Mapping[str] = None,
names: typing.List[str] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
expressions
Optional ¶
- Type: typing.List[
cdk8s_plus_30.LabelExpression
] - Default: no selector requirements.
Namespaces must satisfy these selectors.
The selectors query labels, just like the labels
property, but they
provide a more advanced matching mechanism.
labels
Optional ¶
- Type: typing.Mapping[
str
] - Default: no strict labels requirements.
Labels the namespaces must have.
This is equivalent to using an ‘Is’ selector.
names
Optional ¶
- Type: typing.List[
str
] - Default: no name requirements.
Namespaces names must be one of these.
NetworkPolicy ¶
Control traffic flow at the IP address or port level (OSI layer 3 or 4), network policies are an application-centric construct which allow you to specify how a pod is allowed to communicate with various network peers.
- Outgoing traffic is allowed if there are no network policies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic matches at least one egress rule across all of the network policies that select the pod.
- Incoming traffic is allowed to a pod if there are no network policies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic source is the pod’s local node, OR if the traffic matches at least one ingress rule across all of the network policies that select the pod.
Network policies do not conflict; they are additive. If any policy or policies apply to a given pod for a given direction, the connections allowed in that direction from that pod is the union of what the applicable policies allow. Thus, order of evaluation does not affect the policy result.
For a connection from a source pod to a destination pod to be allowed, both the egress policy on the source pod and the ingress policy on the destination pod need to allow the connection. If either side does not allow the connection, it will not happen.
https://kubernetes.io/docs/concepts/services-networking/network-policies/#networkpolicy-resource
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicy(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
egress: NetworkPolicyTraffic = None,
ingress: NetworkPolicyTraffic = None,
selector: IPodSelector = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
egress
Optional ¶
- Type:
cdk8s_plus_30.NetworkPolicyTraffic
- Default: the policy doesn’t change egress behavior of the pods it selects.
Egress traffic configuration.
ingress
Optional ¶
- Type:
cdk8s_plus_30.NetworkPolicyTraffic
- Default: the policy doesn’t change ingress behavior of the pods it selects.
Ingress traffic configuration.
selector
Optional ¶
- Type:
cdk8s_plus_30.IPodSelector
- Default: will select all pods in the namespace of the policy.
Which pods does this policy object applies to.
This can either be a single pod / workload, or a grouping of pods selected
via the Pods.select
function. Rules is applied to any pods selected by this property.
Multiple network policies can select the same set of pods.
In this case, the rules for each are combined additively.
Note that
Methods ¶
add_egress_rule
¶
def add_egress_rule(
peer: INetworkPolicyPeer,
ports: typing.List[NetworkPolicyPort] = None
)
peer
Required ¶
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.NetworkPolicyPort
]
add_ingress_rule
¶
def add_ingress_rule(
peer: INetworkPolicyPeer,
ports: typing.List[NetworkPolicyPort] = None
)
peer
Required ¶
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.NetworkPolicyPort
]
Properties ¶
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
NetworkPolicyIpBlock ¶
- Implements:
cdk8s_plus_30.INetworkPolicyPeer
Describes a particular CIDR (Ex.
“192.168.1.1/24”,”2001:db9::/64”) that is allowed to the pods matched by a network policy selector. The except entry describes CIDRs that should not be included within this rule.
Methods ¶
to_network_policy_peer_config
¶
def to_network_policy_peer_config()
to_pod_selector
¶
def to_pod_selector()
Static Functions ¶
any_ipv4
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyIpBlock.any_ipv4(
scope: Construct,
id: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
any_ipv6
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyIpBlock.any_ipv6(
scope: Construct,
id: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
ipv4
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyIpBlock.ipv4(
scope: Construct,
id: str,
cidr_ip: str,
except: typing.List[str] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
cidr_ip
Required ¶
- Type:
str
except
Optional ¶
- Type: typing.List[
str
]
ipv6
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyIpBlock.ipv6(
scope: Construct,
id: str,
cidr_ip: str,
except: typing.List[str] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
cidr_ip
Required ¶
- Type:
str
except
Optional ¶
- Type: typing.List[
str
]
Properties ¶
cidr
Required ¶
cidr: str
- Type:
str
A string representing the IP Block Valid examples are “192.168.1.1/24” or “2001:db9::/64”.
except
Optional ¶
except: typing.List[str]
- Type: typing.List[
str
]
A slice of CIDRs that should not be included within an IP Block Valid examples are “192.168.1.1/24” or “2001:db9::/64”. Except values will be rejected if they are outside the CIDR range.
PersistentVolume ¶
- Implements:
cdk8s_plus_30.IPersistentVolume
,cdk8s_plus_30.IStorage
A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator or dynamically provisioned using Storage Classes.
It is a resource in the cluster just like a node is a cluster resource. PVs are volume plugins like Volumes, but have a lifecycle independent of any individual Pod that uses the PV. This API object captures the details of the implementation of the storage, be that NFS, iSCSI, or a cloud-provider-specific storage system.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.PersistentVolume(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
claim: IPersistentVolumeClaim = None,
mount_options: typing.List[str] = None,
reclaim_policy: PersistentVolumeReclaimPolicy = None,
storage: Size = None,
storage_class_name: str = None,
volume_mode: PersistentVolumeMode = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes.
Contains all ways the volume can be mounted.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes
claim
Optional ¶
- Type:
cdk8s_plus_30.IPersistentVolumeClaim
- Default: Not bound to a specific claim.
Part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
Expected to be non-nil when bound.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding
mount_options
Optional ¶
- Type: typing.List[
str
] - Default: No options.
A list of mount options, e.g. [“ro”, “soft”]. Not validated - mount will simply fail if one is invalid.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
reclaim_policy
Optional ¶
- Type:
cdk8s_plus_30.PersistentVolumeReclaimPolicy
- Default: PersistentVolumeReclaimPolicy.RETAIN
When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource.
The reclaim policy tells the cluster what to do with the volume after it has been released of its claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming
storage
Optional ¶
- Type:
cdk8s.Size
- Default: No specified.
What is the storage capacity of this volume.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
- Type:
str
- Default: Volume does not belong to any storage class.
Name of StorageClass to which this persistent volume belongs.
volume_mode
Optional ¶
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
Methods ¶
as_volume
¶
def as_volume()
bind
¶
def bind(
claim: IPersistentVolumeClaim
)
claim
Required ¶
The PVC to bind to.
reserve
¶
def reserve()
Static Functions ¶
from_persistent_volume_name
¶
import cdk8s_plus_30
cdk8s_plus_30.PersistentVolume.from_persistent_volume_name(
scope: Construct,
id: str,
volume_name: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
volume_name
Required ¶
- Type:
str
Properties ¶
mode
Required ¶
mode: PersistentVolumeMode
Volume mode of this volume.
reclaim_policy
Required ¶
reclaim_policy: PersistentVolumeReclaimPolicy
Reclaim policy of this volume.
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
access_modes
Optional ¶
access_modes: typing.List[PersistentVolumeAccessMode]
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
]
Access modes requirement of this claim.
claim
Optional ¶
claim: IPersistentVolumeClaim
PVC this volume is bound to.
Undefined means this volume is not yet claimed by any PVC.
mount_options
Optional ¶
mount_options: typing.List[str]
- Type: typing.List[
str
]
Mount options of this volume.
storage
Optional ¶
storage: Size
- Type:
cdk8s.Size
Storage size of this volume.
storage_class_name
Optional ¶
storage_class_name: str
- Type:
str
Storage class this volume belongs to.
PersistentVolumeClaim ¶
- Implements:
cdk8s_plus_30.IPersistentVolumeClaim
A PersistentVolumeClaim (PVC) is a request for storage by a user.
It is similar to a Pod. Pods consume node resources and PVCs consume PV resources. Pods can request specific levels of resources (CPU and Memory). Claims can request specific size and access modes
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.PersistentVolumeClaim(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
storage: Size = None,
storage_class_name: str = None,
volume: IPersistentVolume = None,
volume_mode: PersistentVolumeMode = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes requirement.
Contains the access modes the volume should support.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1
storage
Optional ¶
- Type:
cdk8s.Size
- Default: No storage requirement.
Minimum storage size the volume should have.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
- Type:
str
- Default: Not set.
Name of the StorageClass required by the claim. When this property is not set, the behavior is as follows:.
- If the admission plugin is turned on, the storage class marked as default will be used.
- If the admission plugin is turned off, the pvc can only be bound to volumes without a storage class.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1
volume
Optional ¶
- Type:
cdk8s_plus_30.IPersistentVolume
- Default: No specific volume binding.
The PersistentVolume backing this claim.
The control plane still checks that storage class, access modes, and requested storage size on the volume are valid.
Note that in order to guarantee a proper binding, the volume should
also define a claimRef
referring to this claim. Otherwise, the volume may be
claimed be other pvc’s before it gets a chance to bind to this one.
If the volume is managed (i.e not imported), you can use pv.claim()
to easily
create a bi-directional bounded claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#binding.
volume_mode
Optional ¶
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
Methods ¶
bind
¶
def bind(
vol: IPersistentVolume
)
vol
Required ¶
The PV to bind to.
Static Functions ¶
from_claim_name
¶
import cdk8s_plus_30
cdk8s_plus_30.PersistentVolumeClaim.from_claim_name(
scope: Construct,
id: str,
claim_name: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
claim_name
Required ¶
- Type:
str
Properties ¶
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
volume_mode
Required ¶
volume_mode: PersistentVolumeMode
Volume mode requirement of this claim.
access_modes
Optional ¶
access_modes: typing.List[PersistentVolumeAccessMode]
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
]
Access modes requirement of this claim.
storage
Optional ¶
storage: Size
- Type:
cdk8s.Size
Storage requirement of this claim.
storage_class_name
Optional ¶
storage_class_name: str
- Type:
str
Storage class requirment of this claim.
volume
Optional ¶
volume: IPersistentVolume
PV this claim is bound to.
Undefined means the claim is not bound to any specific volume.
Pod ¶
Pod is a collection of containers that can run on a host.
This resource is created by clients and scheduled onto hosts.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Pod(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
Properties ¶
connections
Required ¶
connections: PodConnections
pod_metadata
Required ¶
pod_metadata: ApiObjectMetadataDefinition
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
scheduling
Required ¶
scheduling: PodScheduling
Constants ¶
ADDRESS_LABEL
¶
- Type:
str
This label is autoamtically added by cdk8s to any pod.
It provides a unique and stable identifier for the pod.
Pods ¶
- Implements:
cdk8s_plus_30.IPodSelector
Represents a group of pods.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Pods(
scope: Construct,
id: str,
expressions: typing.List[LabelExpression] = None,
labels: typing.Mapping[str] = None,
namespaces: INamespaceSelector = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
expressions
Optional ¶
- Type: typing.List[
cdk8s_plus_30.LabelExpression
]
labels
Optional ¶
- Type: typing.Mapping[
str
]
namespaces
Optional ¶
Methods ¶
to_network_policy_peer_config
¶
def to_network_policy_peer_config()
to_pod_selector
¶
def to_pod_selector()
to_pod_selector_config
¶
def to_pod_selector_config()
Static Functions ¶
all
¶
import cdk8s_plus_30
cdk8s_plus_30.Pods.all(
scope: Construct,
id: str,
namespaces: Namespaces = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
namespaces
Optional ¶
- Type:
cdk8s_plus_30.Namespaces
- Default: unset, implies the namespace of the resource this selection is used in.
Namespaces the pods are allowed to be in.
Use Namespaces.all()
to allow all namespaces.
select
¶
import cdk8s_plus_30
cdk8s_plus_30.Pods.select(
scope: Construct,
id: str,
expressions: typing.List[LabelExpression] = None,
labels: typing.Mapping[str] = None,
namespaces: Namespaces = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
expressions
Optional ¶
- Type: typing.List[
cdk8s_plus_30.LabelExpression
] - Default: no expressions requirements.
Expressions the pods must satisify.
labels
Optional ¶
- Type: typing.Mapping[
str
] - Default: no strict labels requirements.
Labels the pods must have.
namespaces
Optional ¶
- Type:
cdk8s_plus_30.Namespaces
- Default: unset, implies the namespace of the resource this selection is used in.
Namespaces the pods are allowed to be in.
Use Namespaces.all()
to allow all namespaces.
Resource ¶
Base class for all Kubernetes objects in stdk8s.
Represents a single resource.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Resource(
scope: Construct,
id: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
Methods ¶
as_api_resource
¶
def as_api_resource()
as_non_api_resource
¶
def as_non_api_resource()
Properties ¶
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. “authorization.k8s.io”).
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
metadata
Required ¶
metadata: ApiObjectMetadataDefinition
name
Required ¶
name: str
- Type:
str
The name of this API object.
permissions
Required ¶
permissions: ResourcePermissions
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
Role ¶
- Implements:
cdk8s_plus_30.IRole
Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Role(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
rules: typing.List[RolePolicyRule] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
rules
Optional ¶
- Type: typing.List[
cdk8s_plus_30.RolePolicyRule
] - Default: []
A list of rules the role should allow.
Methods ¶
allow
¶
def allow(
verbs: typing.List[str],
resources: IApiResource
)
verbs
Required ¶
- Type: typing.List[
str
]
resources
Required ¶
The resource(s) to apply to.
allow_create
¶
def allow_create(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
allow_delete
¶
def allow_delete(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
allow_delete_collection
¶
def allow_delete_collection(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
allow_get
¶
def allow_get(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
allow_list
¶
def allow_list(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
allow_patch
¶
def allow_patch(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
allow_read
¶
def allow_read(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
allow_read_write
¶
def allow_read_write(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
allow_update
¶
def allow_update(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
allow_watch
¶
def allow_watch(
resources: IApiResource
)
resources
Required ¶
The resource(s) to apply to.
bind
¶
def bind(
subjects: ISubject
)
subjects
Required ¶
- Type:
cdk8s_plus_30.ISubject
a list of subjects to bind to.
Static Functions ¶
from_role_name
¶
import cdk8s_plus_30
cdk8s_plus_30.Role.from_role_name(
scope: Construct,
id: str,
name: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
Properties ¶
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
rules
Required ¶
rules: typing.List[RolePolicyRule]
- Type: typing.List[
cdk8s_plus_30.RolePolicyRule
]
Rules associaated with this Role.
Returns a copy, use allow
to add rules.
RoleBinding ¶
A RoleBinding grants permissions within a specific namespace to a user or set of users.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.RoleBinding(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
role: IRole
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
role
Required ¶
- Type:
cdk8s_plus_30.IRole
The role to bind to.
A RoleBinding can reference a Role or a ClusterRole.
Methods ¶
add_subjects
¶
def add_subjects(
subjects: ISubject
)
subjects
Required ¶
- Type:
cdk8s_plus_30.ISubject
The subjects to add.
Properties ¶
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
role
Required ¶
role: IRole
- Type:
cdk8s_plus_30.IRole
subjects
Required ¶
subjects: typing.List[ISubject]
- Type: typing.List[
cdk8s_plus_30.ISubject
]
Secret ¶
- Implements:
cdk8s_plus_30.ISecret
Kubernetes Secrets let you store and manage sensitive information, such as passwords, OAuth tokens, and ssh keys.
Storing confidential information in a Secret is safer and more flexible than putting it verbatim in a Pod definition or in a container image.
https://kubernetes.io/docs/concepts/configuration/secret
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Secret(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
immutable: bool = None,
string_data: typing.Mapping[str] = None,
type: str = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
string_data
Optional ¶
- Type: typing.Mapping[
str
]
stringData allows specifying non-binary secret data in string form.
It is provided as a write-only convenience method. All keys and values are merged into the data field on write, overwriting any existing values. It is never output when reading from the API.
type
Optional ¶
- Type:
str
- Default: undefined - Don’t set a type.
Optional type associated with the secret.
Used to facilitate programmatic handling of secret data by various controllers.
Methods ¶
add_string_data
¶
def add_string_data(
key: str,
value: str
)
key
Required ¶
- Type:
str
Key.
value
Required ¶
- Type:
str
Value.
env_value
¶
def env_value(
key: str,
optional: bool = None
)
key
Required ¶
- Type:
str
optional
Optional ¶
- Type:
bool
- Default: false
Specify whether the Secret or its key must be defined.
get_string_data
¶
def get_string_data(
key: str
)
key
Required ¶
- Type:
str
Key.
Static Functions ¶
from_secret_name
¶
import cdk8s_plus_30
cdk8s_plus_30.Secret.from_secret_name(
scope: Construct,
id: str,
name: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
Properties ¶
immutable
Required ¶
immutable: bool
- Type:
bool
Whether or not the secret is immutable.
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
Service ¶
An abstract way to expose an application running on a set of Pods as a network service.
With Kubernetes you don’t need to modify your application to use an unfamiliar service discovery mechanism. Kubernetes gives Pods their own IP addresses and a single DNS name for a set of Pods, and can load-balance across them.
For example, consider a stateless image-processing backend which is running with 3 replicas. Those replicas are fungible—frontends do not care which backend they use. While the actual Pods that compose the backend set may change, the frontend clients should not need to be aware of that, nor should they need to keep track of the set of backends themselves. The Service abstraction enables this decoupling.
If you’re able to use Kubernetes APIs for service discovery in your application, you can query the API server for Endpoints, that get updated whenever the set of Pods in a Service changes. For non-native applications, Kubernetes offers ways to place a network port or load balancer in between your application and the backend Pods.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Service(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
cluster_i_p: str = None,
external_i_ps: typing.List[str] = None,
external_name: str = None,
load_balancer_source_ranges: typing.List[str] = None,
ports: typing.List[ServicePort] = None,
publish_not_ready_addresses: bool = None,
selector: IPodSelector = None,
type: ServiceType = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
cluster_i_p
Optional ¶
- Type:
str
- Default: Automatically assigned.
The IP address of the service and is usually assigned randomly by the master.
If an address is specified manually and is not in use by others, it will be allocated to the service; otherwise, creation of the service will fail. This field can not be changed through updates. Valid values are “None”, empty string (“”), or a valid IP address. “None” can be specified for headless services when proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName.
https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
external_i_ps
Optional ¶
- Type: typing.List[
str
] - Default: No external IPs.
A list of IP addresses for which nodes in the cluster will also accept traffic for this service.
These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system.
external_name
Optional ¶
- Type:
str
- Default: No external name.
The externalName to be used when ServiceType.EXTERNAL_NAME is set.
load_balancer_source_ranges
Optional ¶
- Type: typing.List[
str
]
A list of CIDR IP addresses, if specified and supported by the platform, will restrict traffic through the cloud-provider load-balancer to the specified client IPs.
More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ServicePort
] - Default: either the selector ports, or none.
The ports this service binds to.
If the selector of the service is a managed pod / workload, its ports will are automatically extracted and used as the default value. Otherwise, no ports are bound.
publish_not_ready_addresses
Optional ¶
- Type:
bool
- Default: false
The publishNotReadyAddresses indicates that any agent which deals with endpoints for this Service should disregard any indications of ready/not-ready.
More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#servicespec-v1-core
selector
Optional ¶
- Type:
cdk8s_plus_30.IPodSelector
- Default: unset, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify.
Which pods should the service select and route to.
You can pass one of the following:
- An instance of
Pod
or any workload resource (e.gDeployment
,StatefulSet
, …) - Pods selected by the
Pods.select
function. Note that in this case only labels can be specified.
type
Optional ¶
- Type:
cdk8s_plus_30.ServiceType
- Default: ServiceType.ClusterIP
Determines how the Service is exposed.
More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
Methods ¶
bind
¶
def bind(
port: typing.Union[int, float],
name: str = None,
node_port: typing.Union[int, float] = None,
protocol: Protocol = None,
target_port: typing.Union[int, float] = None
)
port
Required ¶
- Type:
typing.Union[int, float]
The port definition.
name
Optional ¶
- Type:
str
The name of this port within the service.
This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. This maps to the ‘Name’ field in EndpointPort objects. Optional if only one ServicePort is defined on this service.
node_port
Optional ¶
- Type:
typing.Union[int, float]
- Default: auto-allocate a port if the ServiceType of this Service requires one.
The port on each node on which this service is exposed when type=NodePort or LoadBalancer.
Usually assigned by the system. If specified, it will be allocated to the service if unused or else creation of the service will fail. Default is to auto-allocate a port if the ServiceType of this Service requires one.
https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
protocol
Optional ¶
- Type:
cdk8s_plus_30.Protocol
- Default: Protocol.TCP
The IP protocol for this port.
Supports “TCP”, “UDP”, and “SCTP”. Default is TCP.
target_port
Optional ¶
- Type:
typing.Union[int, float]
- Default: The value of
port
will be used.
The port number the service will redirect to.
expose_via_ingress
¶
def expose_via_ingress(
path: str,
ingress: Ingress = None,
path_type: HttpIngressPathType = None
)
path
Required ¶
- Type:
str
The path to expose the service under.
ingress
Optional ¶
- Type:
cdk8s_plus_30.Ingress
- Default: An ingress will be automatically created.
The ingress to add rules to.
path_type
Optional ¶
- Type:
cdk8s_plus_30.HttpIngressPathType
- Default: HttpIngressPathType.PREFIX
The type of the path.
select
¶
def select(
selector: IPodSelector
)
selector
Required ¶
select_label
¶
def select_label(
key: str,
value: str
)
key
Required ¶
- Type:
str
value
Required ¶
- Type:
str
Properties ¶
port
Required ¶
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
Return the first port of the service.
ports
Required ¶
ports: typing.List[ServicePort]
- Type: typing.List[
cdk8s_plus_30.ServicePort
]
Ports for this service.
Use bind()
to bind additional service ports.
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
type
Required ¶
type: ServiceType
Determines how the Service is exposed.
cluster_i_p
Optional ¶
cluster_i_p: str
- Type:
str
The IP address of the service and is usually assigned randomly by the master.
external_name
Optional ¶
external_name: str
- Type:
str
The externalName to be used for EXTERNAL_NAME types.
ServiceAccount ¶
- Implements:
cdk8s_plus_30.IServiceAccount
,cdk8s_plus_30.ISubject
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.ServiceAccount(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
automount_token: bool = None,
secrets: typing.List[ISecret] = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_token
Optional ¶
- Type:
bool
- Default: false
Indicates whether pods running as this service account should have an API token automatically mounted.
Can be overridden at the pod level.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
secrets
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ISecret
]
List of secrets allowed to be used by pods running using this ServiceAccount.
https://kubernetes.io/docs/concepts/configuration/secret
Methods ¶
add_secret
¶
def add_secret(
secr: ISecret
)
secr
Required ¶
- Type:
cdk8s_plus_30.ISecret
The secret.
to_subject_configuration
¶
def to_subject_configuration()
Static Functions ¶
from_service_account_name
¶
import cdk8s_plus_30
cdk8s_plus_30.ServiceAccount.from_service_account_name(
scope: Construct,
id: str,
name: str,
namespace_name: str = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
The name of the service account resource.
namespace_name
Optional ¶
- Type:
str
- Default: “default”
The name of the namespace the service account belongs to.
Properties ¶
automount_token
Required ¶
automount_token: bool
- Type:
bool
Whether or not a token is automatically mounted for this service account.
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
secrets
Required ¶
secrets: typing.List[ISecret]
- Type: typing.List[
cdk8s_plus_30.ISecret
]
List of secrets allowed to be used by pods running using this service account.
Returns a copy. To add a secret, use addSecret()
.
ServiceAccountTokenSecret ¶
Create a secret for a service account token.
https://kubernetes.io/docs/concepts/configuration/secret/#service-account-token-secrets
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.ServiceAccountTokenSecret(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
immutable: bool = None,
service_account: IServiceAccount
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
service_account
Required ¶
The service account to store a secret for.
SshAuthSecret ¶
Create a secret for ssh authentication.
https://kubernetes.io/docs/concepts/configuration/secret/#ssh-authentication-secrets
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.SshAuthSecret(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
immutable: bool = None,
ssh_private_key: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
ssh_private_key
Required ¶
- Type:
str
The SSH private key to use.
StatefulSet ¶
- Implements:
cdk8s_plus_30.IScalable
StatefulSet is the workload API object used to manage stateful applications.
Manages the deployment and scaling of a set of Pods, and provides guarantees about the ordering and uniqueness of these Pods.
Like a Deployment, a StatefulSet manages Pods that are based on an identical container spec. Unlike a Deployment, a StatefulSet maintains a sticky identity for each of their Pods. These pods are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.
If you want to use storage volumes to provide persistence for your workload, you can use a StatefulSet as part of the solution. Although individual Pods in a StatefulSet are susceptible to failure, the persistent Pod identifiers make it easier to match existing volumes to the new Pods that replace any that have failed.
Using StatefulSets¶
StatefulSets are valuable for applications that require one or more of the following.
- Stable, unique network identifiers.
- Stable, persistent storage.
- Ordered, graceful deployment and scaling.
- Ordered, automated rolling updates.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.StatefulSet(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
min_ready: Duration = None,
pod_management_policy: PodManagementPolicy = None,
replicas: typing.Union[int, float] = None,
service: Service = None,
strategy: StatefulSetUpdateStrategy = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
min_ready
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(0)
Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
Zero means the pod will be considered available as soon as it is ready.
This is an alpha field and requires enabling StatefulSetMinReadySeconds feature gate.
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#min-ready-seconds
pod_management_policy
Optional ¶
- Type:
cdk8s_plus_30.PodManagementPolicy
- Default: PodManagementPolicy.ORDERED_READY
Pod management policy to use for this statefulset.
replicas
Optional ¶
- Type:
typing.Union[int, float]
- Default: 1
Number of desired pods.
service
Optional ¶
- Type:
cdk8s_plus_30.Service
- Default: A new headless service will be created.
Service to associate with the statefulset.
strategy
Optional ¶
- Type:
cdk8s_plus_30.StatefulSetUpdateStrategy
- Default: RollingUpdate with partition set to 0
Indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.
Methods ¶
mark_has_autoscaler
¶
def mark_has_autoscaler()
to_scaling_target
¶
def to_scaling_target()
Properties ¶
min_ready
Required ¶
min_ready: Duration
- Type:
cdk8s.Duration
Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
pod_management_policy
Required ¶
pod_management_policy: PodManagementPolicy
Management policy to use for the set.
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
service
Required ¶
service: Service
- Type:
cdk8s_plus_30.Service
strategy
Required ¶
strategy: StatefulSetUpdateStrategy
The update startegy of this stateful set.
replicas
Optional ¶
replicas: typing.Union[int, float]
- Type:
typing.Union[int, float]
Number of desired pods.
has_autoscaler
Required ¶
has_autoscaler: bool
- Type:
bool
If this is a target of an autoscaler.
TlsSecret ¶
Create a secret for storing a TLS certificate and its associated key.
https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.TlsSecret(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
immutable: bool = None,
tls_cert: str,
tls_key: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
tls_cert
Required ¶
- Type:
str
The TLS cert.
tls_key
Required ¶
- Type:
str
The TLS key.
User ¶
- Implements:
cdk8s_plus_30.ISubject
Represents a user.
Methods ¶
to_subject_configuration
¶
def to_subject_configuration()
Static Functions ¶
from_name
¶
import cdk8s_plus_30
cdk8s_plus_30.User.from_name(
scope: Construct,
id: str,
name: str
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
Properties ¶
kind
Required ¶
kind: str
- Type:
str
name
Required ¶
name: str
- Type:
str
api_group
Optional ¶
api_group: str
- Type:
str
Volume ¶
- Implements:
cdk8s_plus_30.IStorage
Volume represents a named volume in a pod that may be accessed by any container in the pod.
Docker also has a concept of volumes, though it is somewhat looser and less managed. In Docker, a volume is simply a directory on disk or in another Container. Lifetimes are not managed and until very recently there were only local-disk-backed volumes. Docker now provides volume drivers, but the functionality is very limited for now (e.g. as of Docker 1.7 only one volume driver is allowed per Container and there is no way to pass parameters to volumes).
A Kubernetes volume, on the other hand, has an explicit lifetime - the same as the Pod that encloses it. Consequently, a volume outlives any Containers that run within the Pod, and data is preserved across Container restarts. Of course, when a Pod ceases to exist, the volume will cease to exist, too. Perhaps more importantly than this, Kubernetes supports many types of volumes, and a Pod can use any number of them simultaneously.
At its core, a volume is just a directory, possibly with some data in it, which is accessible to the Containers in a Pod. How that directory comes to be, the medium that backs it, and the contents of it are determined by the particular volume type used.
To use a volume, a Pod specifies what volumes to provide for the Pod (the .spec.volumes field) and where to mount those into Containers (the .spec.containers[*].volumeMounts field).
A process in a container sees a filesystem view composed from their Docker image and volumes. The Docker image is at the root of the filesystem hierarchy, and any volumes are mounted at the specified paths within the image. Volumes can not mount onto other volumes
Methods ¶
as_volume
¶
def as_volume()
Static Functions ¶
from_aws_elastic_block_store
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_aws_elastic_block_store(
scope: Construct,
id: str,
volume_id: str,
fs_type: str = None,
name: str = None,
partition: typing.Union[int, float] = None,
read_only: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
volume_id
Required ¶
- Type:
str
fs_type
Optional ¶
- Type:
str
- Default: ‘ext4’
Filesystem type of the volume that you want to mount.
Tip: Ensure that the filesystem type is supported by the host operating system.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
name
Optional ¶
- Type:
str
- Default: auto-generated
The volume name.
partition
Optional ¶
- Type:
typing.Union[int, float]
- Default: No partition.
The partition in the volume that you want to mount.
If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as “1”. Similarly, the volume partition for /dev/sda is “0” (or you can leave the property empty).
read_only
Optional ¶
- Type:
bool
- Default: false
Specify “true” to force and set the ReadOnly property in VolumeMounts to “true”.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
from_azure_disk
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_azure_disk(
scope: Construct,
id: str,
disk_name: str,
disk_uri: str,
caching_mode: AzureDiskPersistentVolumeCachingMode = None,
fs_type: str = None,
kind: AzureDiskPersistentVolumeKind = None,
name: str = None,
read_only: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
disk_name
Required ¶
- Type:
str
disk_uri
Required ¶
- Type:
str
caching_mode
Optional ¶
- Type:
cdk8s_plus_30.AzureDiskPersistentVolumeCachingMode
- Default: AzureDiskPersistentVolumeCachingMode.NONE.
Host Caching mode.
fs_type
Optional ¶
- Type:
str
- Default: ‘ext4’
Filesystem type to mount.
Must be a filesystem type supported by the host operating system.
kind
Optional ¶
- Type:
cdk8s_plus_30.AzureDiskPersistentVolumeKind
- Default: AzureDiskPersistentVolumeKind.SHARED
Kind of disk.
name
Optional ¶
- Type:
str
- Default: auto-generated
The volume name.
read_only
Optional ¶
- Type:
bool
- Default: false
Force the ReadOnly setting in VolumeMounts.
from_config_map
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_config_map(
scope: Construct,
id: str,
config_map: IConfigMap,
default_mode: typing.Union[int, float] = None,
items: typing.Mapping[PathMapping] = None,
name: str = None,
optional: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
config_map
Required ¶
- Type:
cdk8s_plus_30.IConfigMap
The config map to use to populate the volume.
default_mode
Optional ¶
- Type:
typing.Union[int, float]
- Default: 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
Mode bits to use on created files by default.
Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
items
Optional ¶
- Type: typing.Mapping[
cdk8s_plus_30.PathMapping
] - Default: no mapping
If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value.
If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the ‘..’ path or start with ‘..’.
name
Optional ¶
- Type:
str
- Default: auto-generated
The volume name.
optional
Optional ¶
- Type:
bool
- Default: undocumented
Specify whether the ConfigMap or its keys must be defined.
from_csi
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_csi(
scope: Construct,
id: str,
driver: str,
attributes: typing.Mapping[str] = None,
fs_type: str = None,
name: str = None,
read_only: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
driver
Required ¶
- Type:
str
The name of the CSI driver to use to populate the volume.
attributes
Optional ¶
- Type: typing.Mapping[
str
] - Default: undefined
Any driver-specific attributes to pass to the CSI volume builder.
fs_type
Optional ¶
- Type:
str
- Default: driver-dependent
The filesystem type to mount.
Ex. “ext4”, “xfs”, “ntfs”. If not provided, the empty value is passed to the associated CSI driver, which will determine the default filesystem to apply.
name
Optional ¶
- Type:
str
- Default: auto-generated
The volume name.
read_only
Optional ¶
- Type:
bool
- Default: false
Whether the mounted volume should be read-only or not.
from_empty_dir
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_empty_dir(
scope: Construct,
id: str,
name: str,
medium: EmptyDirMedium = None,
size_limit: Size = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
medium
Optional ¶
- Type:
cdk8s_plus_30.EmptyDirMedium
- Default: EmptyDirMedium.DEFAULT
By default, emptyDir volumes are stored on whatever medium is backing the node - that might be disk or SSD or network storage, depending on your environment.
However, you can set the emptyDir.medium field to
EmptyDirMedium.MEMORY
to tell Kubernetes to mount a tmpfs (RAM-backed
filesystem) for you instead. While tmpfs is very fast, be aware that unlike
disks, tmpfs is cleared on node reboot and any files you write will count
against your Container’s memory limit.
size_limit
Optional ¶
- Type:
cdk8s.Size
- Default: limit is undefined
Total amount of local storage required for this EmptyDir volume.
The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod.
from_gce_persistent_disk
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_gce_persistent_disk(
scope: Construct,
id: str,
pd_name: str,
fs_type: str = None,
name: str = None,
partition: typing.Union[int, float] = None,
read_only: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
pd_name
Required ¶
- Type:
str
fs_type
Optional ¶
- Type:
str
- Default: ‘ext4’
Filesystem type of the volume that you want to mount.
Tip: Ensure that the filesystem type is supported by the host operating system.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
name
Optional ¶
- Type:
str
- Default: auto-generated
The volume name.
partition
Optional ¶
- Type:
typing.Union[int, float]
- Default: No partition.
The partition in the volume that you want to mount.
If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as “1”. Similarly, the volume partition for /dev/sda is “0” (or you can leave the property empty).
read_only
Optional ¶
- Type:
bool
- Default: false
Specify “true” to force and set the ReadOnly property in VolumeMounts to “true”.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
from_host_path
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_host_path(
scope: Construct,
id: str,
name: str,
path: str,
type: HostPathVolumeType = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
path
Required ¶
- Type:
str
The path of the directory on the host.
type
Optional ¶
- Type:
cdk8s_plus_30.HostPathVolumeType
- Default: HostPathVolumeType.DEFAULT
The expected type of the path found on the host.
from_nfs
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_nfs(
scope: Construct,
id: str,
name: str,
path: str,
server: str,
read_only: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
name
Required ¶
- Type:
str
path
Required ¶
- Type:
str
Path that is exported by the NFS server.
server
Required ¶
- Type:
str
Server is the hostname or IP address of the NFS server.
read_only
Optional ¶
- Type:
bool
- Default: false
If set to true, will force the NFS export to be mounted with read-only permissions.
from_persistent_volume_claim
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_persistent_volume_claim(
scope: Construct,
id: str,
claim: IPersistentVolumeClaim,
name: str = None,
read_only: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
claim
Required ¶
name
Optional ¶
- Type:
str
- Default: Derived from the PVC name.
The volume name.
read_only
Optional ¶
- Type:
bool
- Default: false
Will force the ReadOnly setting in VolumeMounts.
from_secret
¶
import cdk8s_plus_30
cdk8s_plus_30.Volume.from_secret(
scope: Construct,
id: str,
secr: ISecret,
default_mode: typing.Union[int, float] = None,
items: typing.Mapping[PathMapping] = None,
name: str = None,
optional: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
secr
Required ¶
- Type:
cdk8s_plus_30.ISecret
The secret to use to populate the volume.
default_mode
Optional ¶
- Type:
typing.Union[int, float]
- Default: 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
Mode bits to use on created files by default.
Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
items
Optional ¶
- Type: typing.Mapping[
cdk8s_plus_30.PathMapping
] - Default: no mapping
If unspecified, each key-value pair in the Data field of the referenced secret will be projected into the volume as a file whose name is the key and content is the value.
If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the ‘..’ path or start with ‘..’.
name
Optional ¶
- Type:
str
- Default: auto-generated
The volume name.
optional
Optional ¶
- Type:
bool
- Default: undocumented
Specify whether the secret or its keys must be defined.
Properties ¶
name
Required ¶
name: str
- Type:
str
Workload ¶
A workload is an application running on Kubernetes.
Whether your workload is a single component or several that work together, on Kubernetes you run it inside a set of pods. In Kubernetes, a Pod represents a set of running containers on your cluster.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Workload(
scope: Construct,
id: str,
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None
)
scope
Required ¶
- Type:
constructs.Construct
id
Required ¶
- Type:
str
metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
Methods ¶
select
¶
def select(
selectors: LabelSelector
)
selectors
Required ¶
Properties ¶
connections
Required ¶
connections: PodConnections
match_expressions
Required ¶
match_expressions: typing.List[LabelSelectorRequirement]
- Type: typing.List[
cdk8s_plus_30.LabelSelectorRequirement
]
The expression matchers this workload will use in order to select pods.
Returns a a copy. Use select()
to add expression matchers.
match_labels
Required ¶
match_labels: typing.Mapping[str]
- Type: typing.Mapping[
str
]
The label matchers this workload will use in order to select pods.
Returns a a copy. Use select()
to add label matchers.
pod_metadata
Required ¶
pod_metadata: ApiObjectMetadataDefinition
The metadata of pods in this workload.
scheduling
Required ¶
scheduling: WorkloadScheduling
Structs ¶
AbstractPodProps ¶
Properties for AbstractPod
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.AbstractPodProps(
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
automount_service_account_token: bool
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
dns: PodDnsProps
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
docker_registry_auth: ISecret
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
host_aliases: typing.List[HostAlias]
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
host_network: bool
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
init_containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
isolate: bool
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
restart_policy: RestartPolicy
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
security_context: PodSecurityContextProps
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
service_account: IServiceAccount
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
termination_grace_period: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
volumes: typing.List[Volume]
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
AddDeploymentOptions ¶
Options to add a deployment to a service.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.AddDeploymentOptions(
name: str = None,
node_port: typing.Union[int, float] = None,
protocol: Protocol = None,
target_port: typing.Union[int, float] = None,
port: typing.Union[int, float] = None
)
name
Optional ¶
name: str
- Type:
str
The name of this port within the service.
This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. This maps to the ‘Name’ field in EndpointPort objects. Optional if only one ServicePort is defined on this service.
node_port
Optional ¶
node_port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: auto-allocate a port if the ServiceType of this Service requires one.
The port on each node on which this service is exposed when type=NodePort or LoadBalancer.
Usually assigned by the system. If specified, it will be allocated to the service if unused or else creation of the service will fail. Default is to auto-allocate a port if the ServiceType of this Service requires one.
https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
protocol
Optional ¶
protocol: Protocol
- Type:
cdk8s_plus_30.Protocol
- Default: Protocol.TCP
The IP protocol for this port.
Supports “TCP”, “UDP”, and “SCTP”. Default is TCP.
target_port
Optional ¶
target_port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: The value of
port
will be used.
The port number the service will redirect to.
port
Optional ¶
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: Copied from the first container of the deployment.
The port number the service will bind to.
AddDirectoryOptions ¶
Options for configmap.addDirectory()
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.AddDirectoryOptions(
exclude: typing.List[str] = None,
key_prefix: str = None
)
exclude
Optional ¶
exclude: typing.List[str]
- Type: typing.List[
str
] - Default: include all files
Glob patterns to exclude when adding files.
key_prefix
Optional ¶
key_prefix: str
- Type:
str
- Default: “”
A prefix to add to all keys in the config map.
ApiResourceOptions ¶
Options for ApiResource
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ApiResourceOptions(
api_group: str,
resource_type: str
)
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of the resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
AwsElasticBlockStorePersistentVolumeProps ¶
Properties for AwsElasticBlockStorePersistentVolume
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.AwsElasticBlockStorePersistentVolumeProps(
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
claim: IPersistentVolumeClaim = None,
mount_options: typing.List[str] = None,
reclaim_policy: PersistentVolumeReclaimPolicy = None,
storage: Size = None,
storage_class_name: str = None,
volume_mode: PersistentVolumeMode = None,
volume_id: str,
fs_type: str = None,
partition: typing.Union[int, float] = None,
read_only: bool = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
access_modes: typing.List[PersistentVolumeAccessMode]
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes.
Contains all ways the volume can be mounted.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes
claim
Optional ¶
claim: IPersistentVolumeClaim
- Type:
cdk8s_plus_30.IPersistentVolumeClaim
- Default: Not bound to a specific claim.
Part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
Expected to be non-nil when bound.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding
mount_options
Optional ¶
mount_options: typing.List[str]
- Type: typing.List[
str
] - Default: No options.
A list of mount options, e.g. [“ro”, “soft”]. Not validated - mount will simply fail if one is invalid.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
reclaim_policy
Optional ¶
reclaim_policy: PersistentVolumeReclaimPolicy
- Type:
cdk8s_plus_30.PersistentVolumeReclaimPolicy
- Default: PersistentVolumeReclaimPolicy.RETAIN
When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource.
The reclaim policy tells the cluster what to do with the volume after it has been released of its claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming
storage
Optional ¶
storage: Size
- Type:
cdk8s.Size
- Default: No specified.
What is the storage capacity of this volume.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
storage_class_name: str
- Type:
str
- Default: Volume does not belong to any storage class.
Name of StorageClass to which this persistent volume belongs.
volume_mode
Optional ¶
volume_mode: PersistentVolumeMode
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
volume_id
Required ¶
volume_id: str
- Type:
str
Unique ID of the persistent disk resource in AWS (Amazon EBS volume).
More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
fs_type
Optional ¶
fs_type: str
- Type:
str
- Default: ‘ext4’
Filesystem type of the volume that you want to mount.
Tip: Ensure that the filesystem type is supported by the host operating system.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
partition
Optional ¶
partition: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: No partition.
The partition in the volume that you want to mount.
If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as “1”. Similarly, the volume partition for /dev/sda is “0” (or you can leave the property empty).
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Specify “true” to force and set the ReadOnly property in VolumeMounts to “true”.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
AwsElasticBlockStoreVolumeOptions ¶
Options of Volume.fromAwsElasticBlockStore
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.AwsElasticBlockStoreVolumeOptions(
fs_type: str = None,
name: str = None,
partition: typing.Union[int, float] = None,
read_only: bool = None
)
fs_type
Optional ¶
fs_type: str
- Type:
str
- Default: ‘ext4’
Filesystem type of the volume that you want to mount.
Tip: Ensure that the filesystem type is supported by the host operating system.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
name
Optional ¶
name: str
- Type:
str
- Default: auto-generated
The volume name.
partition
Optional ¶
partition: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: No partition.
The partition in the volume that you want to mount.
If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as “1”. Similarly, the volume partition for /dev/sda is “0” (or you can leave the property empty).
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Specify “true” to force and set the ReadOnly property in VolumeMounts to “true”.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
AzureDiskPersistentVolumeProps ¶
Properties for AzureDiskPersistentVolume
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.AzureDiskPersistentVolumeProps(
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
claim: IPersistentVolumeClaim = None,
mount_options: typing.List[str] = None,
reclaim_policy: PersistentVolumeReclaimPolicy = None,
storage: Size = None,
storage_class_name: str = None,
volume_mode: PersistentVolumeMode = None,
disk_name: str,
disk_uri: str,
caching_mode: AzureDiskPersistentVolumeCachingMode = None,
fs_type: str = None,
kind: AzureDiskPersistentVolumeKind = None,
read_only: bool = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
access_modes: typing.List[PersistentVolumeAccessMode]
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes.
Contains all ways the volume can be mounted.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes
claim
Optional ¶
claim: IPersistentVolumeClaim
- Type:
cdk8s_plus_30.IPersistentVolumeClaim
- Default: Not bound to a specific claim.
Part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
Expected to be non-nil when bound.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding
mount_options
Optional ¶
mount_options: typing.List[str]
- Type: typing.List[
str
] - Default: No options.
A list of mount options, e.g. [“ro”, “soft”]. Not validated - mount will simply fail if one is invalid.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
reclaim_policy
Optional ¶
reclaim_policy: PersistentVolumeReclaimPolicy
- Type:
cdk8s_plus_30.PersistentVolumeReclaimPolicy
- Default: PersistentVolumeReclaimPolicy.RETAIN
When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource.
The reclaim policy tells the cluster what to do with the volume after it has been released of its claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming
storage
Optional ¶
storage: Size
- Type:
cdk8s.Size
- Default: No specified.
What is the storage capacity of this volume.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
storage_class_name: str
- Type:
str
- Default: Volume does not belong to any storage class.
Name of StorageClass to which this persistent volume belongs.
volume_mode
Optional ¶
volume_mode: PersistentVolumeMode
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
disk_name
Required ¶
disk_name: str
- Type:
str
The Name of the data disk in the blob storage.
disk_uri
Required ¶
disk_uri: str
- Type:
str
The URI the data disk in the blob storage.
caching_mode
Optional ¶
caching_mode: AzureDiskPersistentVolumeCachingMode
- Type:
cdk8s_plus_30.AzureDiskPersistentVolumeCachingMode
- Default: AzureDiskPersistentVolumeCachingMode.NONE.
Host Caching mode.
fs_type
Optional ¶
fs_type: str
- Type:
str
- Default: ‘ext4’
Filesystem type to mount.
Must be a filesystem type supported by the host operating system.
kind
Optional ¶
kind: AzureDiskPersistentVolumeKind
- Type:
cdk8s_plus_30.AzureDiskPersistentVolumeKind
- Default: AzureDiskPersistentVolumeKind.SHARED
Kind of disk.
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Force the ReadOnly setting in VolumeMounts.
AzureDiskVolumeOptions ¶
Options of Volume.fromAzureDisk
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.AzureDiskVolumeOptions(
caching_mode: AzureDiskPersistentVolumeCachingMode = None,
fs_type: str = None,
kind: AzureDiskPersistentVolumeKind = None,
name: str = None,
read_only: bool = None
)
caching_mode
Optional ¶
caching_mode: AzureDiskPersistentVolumeCachingMode
- Type:
cdk8s_plus_30.AzureDiskPersistentVolumeCachingMode
- Default: AzureDiskPersistentVolumeCachingMode.NONE.
Host Caching mode.
fs_type
Optional ¶
fs_type: str
- Type:
str
- Default: ‘ext4’
Filesystem type to mount.
Must be a filesystem type supported by the host operating system.
kind
Optional ¶
kind: AzureDiskPersistentVolumeKind
- Type:
cdk8s_plus_30.AzureDiskPersistentVolumeKind
- Default: AzureDiskPersistentVolumeKind.SHARED
Kind of disk.
name
Optional ¶
name: str
- Type:
str
- Default: auto-generated
The volume name.
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Force the ReadOnly setting in VolumeMounts.
BasicAuthSecretProps ¶
Options for BasicAuthSecret
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.BasicAuthSecretProps(
metadata: ApiObjectMetadata = None,
immutable: bool = None,
password: str,
username: str
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
immutable: bool
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
password
Required ¶
password: str
- Type:
str
The password or token for authentication.
username
Required ¶
username: str
- Type:
str
The user name for authentication.
ClusterRoleBindingProps ¶
Properties for ClusterRoleBinding
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ClusterRoleBindingProps(
metadata: ApiObjectMetadata = None,
role: IClusterRole
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
role
Required ¶
role: IClusterRole
The role to bind to.
ClusterRolePolicyRule ¶
Policy rule of a `ClusterRole.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ClusterRolePolicyRule(
endpoints: typing.List[IApiEndpoint],
verbs: typing.List[str]
)
endpoints
Required ¶
endpoints: typing.List[IApiEndpoint]
- Type: typing.List[
cdk8s_plus_30.IApiEndpoint
]
Endpoints this rule applies to.
Can be either api resources or non api resources.
verbs
Required ¶
verbs: typing.List[str]
- Type: typing.List[
str
]
Verbs to allow.
(e.g [‘get’, ‘watch’])
ClusterRoleProps ¶
Properties for ClusterRole
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ClusterRoleProps(
metadata: ApiObjectMetadata = None,
aggregation_labels: typing.Mapping[str] = None,
rules: typing.List[ClusterRolePolicyRule] = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
aggregation_labels
Optional ¶
aggregation_labels: typing.Mapping[str]
- Type: typing.Mapping[
str
]
Specify labels that should be used to locate ClusterRoles, whose rules will be automatically filled into this ClusterRole’s rules.
rules
Optional ¶
rules: typing.List[ClusterRolePolicyRule]
- Type: typing.List[
cdk8s_plus_30.ClusterRolePolicyRule
] - Default: []
A list of rules the role should allow.
CommandProbeOptions ¶
Options for Probe.fromCommand()
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.CommandProbeOptions(
failure_threshold: typing.Union[int, float] = None,
initial_delay_seconds: Duration = None,
period_seconds: Duration = None,
success_threshold: typing.Union[int, float] = None,
timeout_seconds: Duration = None
)
failure_threshold
Optional ¶
failure_threshold: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 3
Minimum consecutive failures for the probe to be considered failed after having succeeded.
Defaults to 3. Minimum value is 1.
initial_delay_seconds
Optional ¶
initial_delay_seconds: Duration
- Type:
cdk8s.Duration
- Default: immediate
Number of seconds after the container has started before liveness probes are initiated.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
period_seconds
Optional ¶
period_seconds: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(10) Minimum value is 1.
How often (in seconds) to perform the probe.
Default to 10 seconds. Minimum value is 1.
success_threshold
Optional ¶
success_threshold: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 1 Must be 1 for liveness and startup. Minimum value is 1.
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.
timeout_seconds
Optional ¶
timeout_seconds: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(1)
Number of seconds after which the probe times out.
Defaults to 1 second. Minimum value is 1.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
CommonSecretProps ¶
Common properties for Secret
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.CommonSecretProps(
metadata: ApiObjectMetadata = None,
immutable: bool = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
immutable: bool
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
ConfigMapProps ¶
Properties for initialization of ConfigMap
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ConfigMapProps(
metadata: ApiObjectMetadata = None,
binary_data: typing.Mapping[str] = None,
data: typing.Mapping[str] = None,
immutable: bool = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
binary_data
Optional ¶
binary_data: typing.Mapping[str]
- Type: typing.Mapping[
str
]
BinaryData contains the binary data.
Each key must consist of alphanumeric characters, ‘-‘, ‘_’ or ‘.’. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process.
You can also add binary data using configMap.addBinaryData()
.
data
Optional ¶
data: typing.Mapping[str]
- Type: typing.Mapping[
str
]
Data contains the configuration data.
Each key must consist of alphanumeric characters, ‘-‘, ‘_’ or ‘.’. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process.
You can also add data using configMap.addData()
.
immutable
Optional ¶
immutable: bool
- Type:
bool
- Default: false
If set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
ConfigMapVolumeOptions ¶
Options for the ConfigMap-based volume.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ConfigMapVolumeOptions(
default_mode: typing.Union[int, float] = None,
items: typing.Mapping[PathMapping] = None,
name: str = None,
optional: bool = None
)
default_mode
Optional ¶
default_mode: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
Mode bits to use on created files by default.
Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
items
Optional ¶
items: typing.Mapping[PathMapping]
- Type: typing.Mapping[
cdk8s_plus_30.PathMapping
] - Default: no mapping
If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value.
If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the ‘..’ path or start with ‘..’.
name
Optional ¶
name: str
- Type:
str
- Default: auto-generated
The volume name.
optional
Optional ¶
optional: bool
- Type:
bool
- Default: undocumented
Specify whether the ConfigMap or its keys must be defined.
ContainerLifecycle ¶
Container lifecycle properties.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ContainerLifecycle(
post_start: Handler = None,
pre_stop: Handler = None
)
post_start
Optional ¶
post_start: Handler
- Type:
cdk8s_plus_30.Handler
- Default: No post start handler.
This hook is executed immediately after a container is created.
However, there is no guarantee that the hook will execute before the container ENTRYPOINT.
pre_stop
Optional ¶
pre_stop: Handler
- Type:
cdk8s_plus_30.Handler
- Default: No pre stop handler.
This hook is called immediately before a container is terminated due to an API request or management event such as a liveness/startup probe failure, preemption, resource contention and others.
A call to the PreStop hook fails if the container is already in a terminated or completed state and the hook must complete before the TERM signal to stop the container can be sent. The Pod’s termination grace period countdown begins before the PreStop hook is executed, so regardless of the outcome of the handler, the container will eventually terminate within the Pod’s termination grace period. No parameters are passed to the handler.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination
ContainerOpts ¶
Optional properties of a container.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ContainerOpts(
args: typing.List[str] = None,
command: typing.List[str] = None,
env_from: typing.List[EnvFrom] = None,
env_variables: typing.Mapping[EnvValue] = None,
image_pull_policy: ImagePullPolicy = None,
lifecycle: ContainerLifecycle = None,
liveness: Probe = None,
name: str = None,
port: typing.Union[int, float] = None,
port_number: typing.Union[int, float] = None,
ports: typing.List[ContainerPort] = None,
readiness: Probe = None,
resources: ContainerResources = None,
restart_policy: ContainerRestartPolicy = None,
security_context: ContainerSecurityContextProps = None,
startup: Probe = None,
volume_mounts: typing.List[VolumeMount] = None,
working_dir: str = None
)
args
Optional ¶
args: typing.List[str]
- Type: typing.List[
str
] - Default: []
Arguments to the entrypoint. The docker image’s CMD is used if command
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.
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
command
Optional ¶
command: typing.List[str]
- Type: typing.List[
str
] - Default: The docker image’s ENTRYPOINT.
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
env_from
Optional ¶
env_from: typing.List[EnvFrom]
- Type: typing.List[
cdk8s_plus_30.EnvFrom
] - Default: No sources.
List of sources to populate environment variables in the container.
When a key exists in multiple sources, the value associated with
the last source will take precedence. Values defined by the envVariables
property
with a duplicate key will take precedence.
env_variables
Optional ¶
env_variables: typing.Mapping[EnvValue]
- Type: typing.Mapping[
cdk8s_plus_30.EnvValue
] - Default: No environment variables.
Environment variables to set in the container.
image_pull_policy
Optional ¶
image_pull_policy: ImagePullPolicy
- Type:
cdk8s_plus_30.ImagePullPolicy
- Default: ImagePullPolicy.ALWAYS
Image pull policy for this container.
lifecycle
Optional ¶
lifecycle: ContainerLifecycle
Describes actions that the management system should take in response to container lifecycle events.
liveness
Optional ¶
liveness: Probe
- Type:
cdk8s_plus_30.Probe
- Default: no liveness probe is defined
Periodic probe of container liveness.
Container will be restarted if the probe fails.
name
Optional ¶
name: str
- Type:
str
- Default: ‘main’
Name of the container specified as a DNS_LABEL.
Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.
~~port
~~Optional ¶
- Deprecated: - use
portNumber
.
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
port_number
Optional ¶
port_number: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: Only the ports mentiond in the
ports
property are exposed.
Number of port to expose on the pod’s IP address.
This must be a valid port number, 0 < x < 65536.
This is a convinience property if all you need a single TCP numbered port.
In case more advanced configuartion is required, use the ports
property.
This port is added to the list of ports mentioned in the ports
property.
ports
Optional ¶
ports: typing.List[ContainerPort]
- Type: typing.List[
cdk8s_plus_30.ContainerPort
] - Default: Only the port mentioned in the
portNumber
property is exposed.
List of ports to expose from this container.
readiness
Optional ¶
readiness: Probe
- Type:
cdk8s_plus_30.Probe
- Default: no readiness probe is defined
Determines when the container is ready to serve traffic.
resources
Optional ¶
resources: ContainerResources
- Type:
cdk8s_plus_30.ContainerResources
- Default: cpu: request: 1000 millis limit: 1500 millis memory: request: 512 mebibytes limit: 2048 mebibytes
Compute resources (CPU and memory requests and limits) required by the container.
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
restart_policy
Optional ¶
restart_policy: ContainerRestartPolicy
- Type:
cdk8s_plus_30.ContainerRestartPolicy
- Default: no restart policy is defined and the pod restart policy is applied
Kubelet will start init containers with restartPolicy=Always in the order with other init containers, but instead of waiting for its completion, it will wait for the container startup completion Currently, only accepted value is Always.
https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
security_context
Optional ¶
security_context: ContainerSecurityContextProps
- Type:
cdk8s_plus_30.ContainerSecurityContextProps
- Default: ensureNonRoot: true privileged: false readOnlyRootFilesystem: true allowPrivilegeEscalation: false user: 25000 group: 26000
SecurityContext defines the security options the container should be run with.
If set, the fields override equivalent fields of the pod’s security context.
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
startup
Optional ¶
startup: Probe
- Type:
cdk8s_plus_30.Probe
- Default: If a port is provided, then knocks on that port to determine when the container is ready for readiness and liveness probe checks. Otherwise, no startup probe is defined.
StartupProbe indicates that the Pod has successfully initialized.
If specified, no other probes are executed until this completes successfully
volume_mounts
Optional ¶
volume_mounts: typing.List[VolumeMount]
- Type: typing.List[
cdk8s_plus_30.VolumeMount
]
Pod volumes to mount into the container’s filesystem.
Cannot be updated.
working_dir
Optional ¶
working_dir: str
- Type:
str
- Default: The container runtime’s default.
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.
ContainerPort ¶
Represents a network port in a single container.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ContainerPort(
number: typing.Union[int, float],
host_ip: str = None,
host_port: typing.Union[int, float] = None,
name: str = None,
protocol: Protocol = None
)
number
Required ¶
number: typing.Union[int, float]
- Type:
typing.Union[int, float]
Number of port to expose on the pod’s IP address.
This must be a valid port number, 0 < x < 65536.
host_ip
Optional ¶
host_ip: str
- Type:
str
- Default: 127.0.0.1.
What host IP to bind the external port to.
host_port
Optional ¶
host_port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: auto generated by kubernetes and might change on restarts.
Number of port to expose on the host.
If specified, this must be a valid port number, 0 < x < 65536. Most containers do not need this.
name
Optional ¶
name: str
- Type:
str
- Default: port is not named.
If specified, this must be an IANA_SVC_NAME and unique within the pod.
Each named port in a pod must have a unique name. Name for the port that can be referred to by services.
protocol
Optional ¶
protocol: Protocol
- Type:
cdk8s_plus_30.Protocol
- Default: Protocol.TCP
Protocol for port.
Must be UDP, TCP, or SCTP. Defaults to “TCP”.
ContainerProps ¶
Properties for creating a container.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ContainerProps(
args: typing.List[str] = None,
command: typing.List[str] = None,
env_from: typing.List[EnvFrom] = None,
env_variables: typing.Mapping[EnvValue] = None,
image_pull_policy: ImagePullPolicy = None,
lifecycle: ContainerLifecycle = None,
liveness: Probe = None,
name: str = None,
port: typing.Union[int, float] = None,
port_number: typing.Union[int, float] = None,
ports: typing.List[ContainerPort] = None,
readiness: Probe = None,
resources: ContainerResources = None,
restart_policy: ContainerRestartPolicy = None,
security_context: ContainerSecurityContextProps = None,
startup: Probe = None,
volume_mounts: typing.List[VolumeMount] = None,
working_dir: str = None,
image: str
)
args
Optional ¶
args: typing.List[str]
- Type: typing.List[
str
] - Default: []
Arguments to the entrypoint. The docker image’s CMD is used if command
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.
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
command
Optional ¶
command: typing.List[str]
- Type: typing.List[
str
] - Default: The docker image’s ENTRYPOINT.
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
env_from
Optional ¶
env_from: typing.List[EnvFrom]
- Type: typing.List[
cdk8s_plus_30.EnvFrom
] - Default: No sources.
List of sources to populate environment variables in the container.
When a key exists in multiple sources, the value associated with
the last source will take precedence. Values defined by the envVariables
property
with a duplicate key will take precedence.
env_variables
Optional ¶
env_variables: typing.Mapping[EnvValue]
- Type: typing.Mapping[
cdk8s_plus_30.EnvValue
] - Default: No environment variables.
Environment variables to set in the container.
image_pull_policy
Optional ¶
image_pull_policy: ImagePullPolicy
- Type:
cdk8s_plus_30.ImagePullPolicy
- Default: ImagePullPolicy.ALWAYS
Image pull policy for this container.
lifecycle
Optional ¶
lifecycle: ContainerLifecycle
Describes actions that the management system should take in response to container lifecycle events.
liveness
Optional ¶
liveness: Probe
- Type:
cdk8s_plus_30.Probe
- Default: no liveness probe is defined
Periodic probe of container liveness.
Container will be restarted if the probe fails.
name
Optional ¶
name: str
- Type:
str
- Default: ‘main’
Name of the container specified as a DNS_LABEL.
Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.
~~port
~~Optional ¶
- Deprecated: - use
portNumber
.
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
port_number
Optional ¶
port_number: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: Only the ports mentiond in the
ports
property are exposed.
Number of port to expose on the pod’s IP address.
This must be a valid port number, 0 < x < 65536.
This is a convinience property if all you need a single TCP numbered port.
In case more advanced configuartion is required, use the ports
property.
This port is added to the list of ports mentioned in the ports
property.
ports
Optional ¶
ports: typing.List[ContainerPort]
- Type: typing.List[
cdk8s_plus_30.ContainerPort
] - Default: Only the port mentioned in the
portNumber
property is exposed.
List of ports to expose from this container.
readiness
Optional ¶
readiness: Probe
- Type:
cdk8s_plus_30.Probe
- Default: no readiness probe is defined
Determines when the container is ready to serve traffic.
resources
Optional ¶
resources: ContainerResources
- Type:
cdk8s_plus_30.ContainerResources
- Default: cpu: request: 1000 millis limit: 1500 millis memory: request: 512 mebibytes limit: 2048 mebibytes
Compute resources (CPU and memory requests and limits) required by the container.
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
restart_policy
Optional ¶
restart_policy: ContainerRestartPolicy
- Type:
cdk8s_plus_30.ContainerRestartPolicy
- Default: no restart policy is defined and the pod restart policy is applied
Kubelet will start init containers with restartPolicy=Always in the order with other init containers, but instead of waiting for its completion, it will wait for the container startup completion Currently, only accepted value is Always.
https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
security_context
Optional ¶
security_context: ContainerSecurityContextProps
- Type:
cdk8s_plus_30.ContainerSecurityContextProps
- Default: ensureNonRoot: true privileged: false readOnlyRootFilesystem: true allowPrivilegeEscalation: false user: 25000 group: 26000
SecurityContext defines the security options the container should be run with.
If set, the fields override equivalent fields of the pod’s security context.
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
startup
Optional ¶
startup: Probe
- Type:
cdk8s_plus_30.Probe
- Default: If a port is provided, then knocks on that port to determine when the container is ready for readiness and liveness probe checks. Otherwise, no startup probe is defined.
StartupProbe indicates that the Pod has successfully initialized.
If specified, no other probes are executed until this completes successfully
volume_mounts
Optional ¶
volume_mounts: typing.List[VolumeMount]
- Type: typing.List[
cdk8s_plus_30.VolumeMount
]
Pod volumes to mount into the container’s filesystem.
Cannot be updated.
working_dir
Optional ¶
working_dir: str
- Type:
str
- Default: The container runtime’s default.
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.
image
Required ¶
image: str
- Type:
str
Docker image name.
ContainerResources ¶
CPU and memory compute resources.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ContainerResources(
cpu: CpuResources = None,
ephemeral_storage: EphemeralStorageResources = None,
memory: MemoryResources = None
)
cpu
Optional ¶
cpu: CpuResources
ephemeral_storage
Optional ¶
ephemeral_storage: EphemeralStorageResources
memory
Optional ¶
memory: MemoryResources
ContainerSecurityContextProps ¶
Properties for ContainerSecurityContext
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ContainerSecurityContextProps(
allow_privilege_escalation: bool = None,
capabilities: ContainerSecutiryContextCapabilities = None,
ensure_non_root: bool = None,
group: typing.Union[int, float] = None,
privileged: bool = None,
read_only_root_filesystem: bool = None,
seccomp_profile: SeccompProfile = None,
user: typing.Union[int, float] = None
)
allow_privilege_escalation
Optional ¶
allow_privilege_escalation: bool
- Type:
bool
- Default: false
Whether a process can gain more privileges than its parent process.
capabilities
Optional ¶
capabilities: ContainerSecutiryContextCapabilities
- Type:
cdk8s_plus_30.ContainerSecutiryContextCapabilities
- Default: none
POSIX capabilities for running containers.
ensure_non_root
Optional ¶
ensure_non_root: bool
- Type:
bool
- Default: true
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.
group
Optional ¶
group: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 26000. An arbitrary number bigger than 9999 is selected here. This is so that the container is blocked to access host files even if somehow it manages to get access to host file system.
The GID to run the entrypoint of the container process.
privileged
Optional ¶
privileged: bool
- Type:
bool
- Default: false
Run container in privileged mode.
Processes in privileged containers are essentially equivalent to root on the host.
read_only_root_filesystem
Optional ¶
read_only_root_filesystem: bool
- Type:
bool
- Default: true
Whether this container has a read-only root filesystem.
seccomp_profile
Optional ¶
seccomp_profile: SeccompProfile
- Type:
cdk8s_plus_30.SeccompProfile
- Default: none
Container’s seccomp profile settings.
Only one profile source may be set
user
Optional ¶
user: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 25000. An arbitrary number bigger than 9999 is selected here. This is so that the container is blocked to access host files even if somehow it manages to get access to host file system.
The UID to run the entrypoint of the container process.
ContainerSecutiryContextCapabilities ¶
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ContainerSecutiryContextCapabilities(
add: typing.List[Capability] = None,
drop: typing.List[Capability] = None
)
add
Optional ¶
add: typing.List[Capability]
- Type: typing.List[
cdk8s_plus_30.Capability
]
Added capabilities.
drop
Optional ¶
drop: typing.List[Capability]
- Type: typing.List[
cdk8s_plus_30.Capability
]
Removed capabilities.
CpuResources ¶
CPU request and limit.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.CpuResources(
limit: Cpu = None,
request: Cpu = None
)
limit
Optional ¶
limit: Cpu
- Type:
cdk8s_plus_30.Cpu
request
Optional ¶
request: Cpu
- Type:
cdk8s_plus_30.Cpu
CronJobProps ¶
Properties for CronJob
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.CronJobProps(
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
active_deadline: Duration = None,
backoff_limit: typing.Union[int, float] = None,
ttl_after_finished: Duration = None,
schedule: Cron,
concurrency_policy: ConcurrencyPolicy = None,
failed_jobs_retained: typing.Union[int, float] = None,
starting_deadline: Duration = None,
successful_jobs_retained: typing.Union[int, float] = None,
suspend: bool = None,
time_zone: str = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
automount_service_account_token: bool
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
dns: PodDnsProps
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
docker_registry_auth: ISecret
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
host_aliases: typing.List[HostAlias]
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
host_network: bool
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
init_containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
isolate: bool
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
restart_policy: RestartPolicy
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
security_context: PodSecurityContextProps
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
service_account: IServiceAccount
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
termination_grace_period: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
volumes: typing.List[Volume]
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
pod_metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
select: bool
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
spread: bool
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
active_deadline
Optional ¶
active_deadline: Duration
- Type:
cdk8s.Duration
- Default: If unset, then there is no deadline.
Specifies the duration the job may be active before the system tries to terminate it.
backoff_limit
Optional ¶
backoff_limit: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: If not set, system defaults to 6.
Specifies the number of retries before marking this job failed.
ttl_after_finished
Optional ¶
ttl_after_finished: Duration
- Type:
cdk8s.Duration
- Default: If this field is unset, the Job won’t be automatically deleted.
Limits the lifetime of a Job that has finished execution (either Complete or Failed).
If this field is set, after the Job finishes, it is eligible to
be automatically deleted. When the Job is being deleted, its lifecycle
guarantees (e.g. finalizers) will be honored. If this field is set to zero,
the Job becomes eligible to be deleted immediately after it finishes. This
field is alpha-level and is only honored by servers that enable the
TTLAfterFinished
feature.
schedule
Required ¶
schedule: Cron
- Type:
cdk8s.Cron
Specifies the time in which the job would run again.
This is defined as a cron expression in the CronJob resource.
concurrency_policy
Optional ¶
concurrency_policy: ConcurrencyPolicy
- Type:
cdk8s_plus_30.ConcurrencyPolicy
- Default: ConcurrencyPolicy.Forbid
Specifies the concurrency policy for the job.
failed_jobs_retained
Optional ¶
failed_jobs_retained: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 1
Specifies the number of failed jobs history retained.
This would retain the Job and the associated Pod resource and can be useful for debugging.
starting_deadline
Optional ¶
starting_deadline: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(10)
Kubernetes attempts to start cron jobs at its schedule time, but this is not guaranteed.
This deadline specifies how much time can pass after a schedule point, for which kubernetes can still start the job. For example, if this is set to 100 seconds, kubernetes is allowed to start the job at a maximum 100 seconds after the scheduled time.
Note that the Kubernetes CronJobController checks for things every 10 seconds, for this reason, a deadline below 10 seconds is not allowed, as it may cause your job to never be scheduled.
In addition, kubernetes will stop scheduling jobs if more than 100 schedules were missed (for any reason). This property also controls what time interval should kubernetes consider when counting for missed schedules.
For example, suppose a CronJob is set to schedule a new Job every one minute beginning at 08:30:00,
and its startingDeadline
field is not set. If the CronJob controller happens to be down from 08:29:00 to 10:21:00,
the job will not start as the number of missed jobs which missed their schedule is greater than 100.
However, if startingDeadline
is set to 200 seconds, kubernetes will only count 3 missed schedules, and thus
start a new execution at 10:22:00.
successful_jobs_retained
Optional ¶
successful_jobs_retained: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 3
Specifies the number of successful jobs history retained.
This would retain the Job and the associated Pod resource and can be useful for debugging.
suspend
Optional ¶
suspend: bool
- Type:
bool
- Default: false
Specifies if the cron job should be suspended.
Only applies to future executions, current ones are remained untouched.
time_zone
Optional ¶
time_zone: str
- Type:
str
- Default: Timezone of kube-controller-manager process.
Specifies the timezone for the job.
This helps aligining the schedule to follow the specified timezone.
{@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones} for list of valid timezone values.
CsiVolumeOptions ¶
Options for the CSI driver based volume.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.CsiVolumeOptions(
attributes: typing.Mapping[str] = None,
fs_type: str = None,
name: str = None,
read_only: bool = None
)
attributes
Optional ¶
attributes: typing.Mapping[str]
- Type: typing.Mapping[
str
] - Default: undefined
Any driver-specific attributes to pass to the CSI volume builder.
fs_type
Optional ¶
fs_type: str
- Type:
str
- Default: driver-dependent
The filesystem type to mount.
Ex. “ext4”, “xfs”, “ntfs”. If not provided, the empty value is passed to the associated CSI driver, which will determine the default filesystem to apply.
name
Optional ¶
name: str
- Type:
str
- Default: auto-generated
The volume name.
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Whether the mounted volume should be read-only or not.
DaemonSetProps ¶
Properties for DaemonSet
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.DaemonSetProps(
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
min_ready_seconds: typing.Union[int, float] = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
automount_service_account_token: bool
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
dns: PodDnsProps
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
docker_registry_auth: ISecret
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
host_aliases: typing.List[HostAlias]
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
host_network: bool
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
init_containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
isolate: bool
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
restart_policy: RestartPolicy
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
security_context: PodSecurityContextProps
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
service_account: IServiceAccount
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
termination_grace_period: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
volumes: typing.List[Volume]
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
pod_metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
select: bool
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
spread: bool
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
min_ready_seconds
Optional ¶
min_ready_seconds: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 0
Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
DeploymentExposeViaServiceOptions ¶
Options for Deployment.exposeViaService
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.DeploymentExposeViaServiceOptions(
name: str = None,
ports: typing.List[ServicePort] = None,
service_type: ServiceType = None
)
name
Optional ¶
name: str
- Type:
str
- Default: auto generated.
The name of the service to expose.
If you’d like to expose the deployment multiple times, you must explicitly set a name starting from the second expose call.
ports
Optional ¶
ports: typing.List[ServicePort]
- Type: typing.List[
cdk8s_plus_30.ServicePort
] - Default: extracted from the deployment.
The ports that the service should bind to.
service_type
Optional ¶
service_type: ServiceType
- Type:
cdk8s_plus_30.ServiceType
- Default: ClusterIP.
The type of the exposed service.
DeploymentProps ¶
Properties for Deployment
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.DeploymentProps(
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
min_ready: Duration = None,
progress_deadline: Duration = None,
replicas: typing.Union[int, float] = None,
strategy: DeploymentStrategy = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
automount_service_account_token: bool
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
dns: PodDnsProps
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
docker_registry_auth: ISecret
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
host_aliases: typing.List[HostAlias]
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
host_network: bool
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
init_containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
isolate: bool
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
restart_policy: RestartPolicy
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
security_context: PodSecurityContextProps
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
service_account: IServiceAccount
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
termination_grace_period: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
volumes: typing.List[Volume]
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
pod_metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
select: bool
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
spread: bool
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
min_ready
Optional ¶
min_ready: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(0)
Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
Zero means the pod will be considered available as soon as it is ready.
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#min-ready-seconds
progress_deadline
Optional ¶
progress_deadline: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(600)
The maximum duration for a deployment to make progress before it is considered to be failed.
The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status.
Note that progress will not be estimated during the time a deployment is paused.
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#progress-deadline-seconds
replicas
Optional ¶
replicas: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 2
Number of desired pods.
strategy
Optional ¶
strategy: DeploymentStrategy
- Type:
cdk8s_plus_30.DeploymentStrategy
- Default: RollingUpdate with maxSurge and maxUnavailable set to 25%.
Specifies the strategy used to replace old Pods by new ones.
DeploymentStrategyRollingUpdateOptions ¶
Options for DeploymentStrategy.rollingUpdate
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.DeploymentStrategyRollingUpdateOptions(
max_surge: PercentOrAbsolute = None,
max_unavailable: PercentOrAbsolute = None
)
max_surge
Optional ¶
max_surge: PercentOrAbsolute
- Type:
cdk8s_plus_30.PercentOrAbsolute
- Default: ‘25%’
The maximum number of pods that can be scheduled above the desired number of pods.
Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
Absolute number is calculated from percentage by rounding up.
This can not be 0 if maxUnavailable
is 0.
Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.
max_unavailable
Optional ¶
max_unavailable: PercentOrAbsolute
- Type:
cdk8s_plus_30.PercentOrAbsolute
- Default: ‘25%’
The maximum number of pods that can be unavailable during the update.
Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
Absolute number is calculated from percentage by rounding down.
This can not be 0 if maxSurge
is 0.
Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.
DnsOption ¶
Custom DNS option.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.DnsOption(
name: str,
value: str = None
)
name
Required ¶
name: str
- Type:
str
Option name.
value
Optional ¶
value: str
- Type:
str
- Default: No value.
Option value.
DockerConfigSecretProps ¶
Options for DockerConfigSecret
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.DockerConfigSecretProps(
metadata: ApiObjectMetadata = None,
immutable: bool = None,
data: typing.Mapping[typing.Any]
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
immutable: bool
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
data
Required ¶
data: typing.Mapping[typing.Any]
- Type: typing.Mapping[
typing.Any
]
JSON content to provide for the ~/.docker/config.json
file. This will be stringified and inserted as stringData.
https://docs.docker.com/engine/reference/commandline/cli/#sample-configuration-file
EmptyDirVolumeOptions ¶
Options for volumes populated with an empty directory.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.EmptyDirVolumeOptions(
medium: EmptyDirMedium = None,
size_limit: Size = None
)
medium
Optional ¶
medium: EmptyDirMedium
- Type:
cdk8s_plus_30.EmptyDirMedium
- Default: EmptyDirMedium.DEFAULT
By default, emptyDir volumes are stored on whatever medium is backing the node - that might be disk or SSD or network storage, depending on your environment.
However, you can set the emptyDir.medium field to
EmptyDirMedium.MEMORY
to tell Kubernetes to mount a tmpfs (RAM-backed
filesystem) for you instead. While tmpfs is very fast, be aware that unlike
disks, tmpfs is cleared on node reboot and any files you write will count
against your Container’s memory limit.
size_limit
Optional ¶
size_limit: Size
- Type:
cdk8s.Size
- Default: limit is undefined
Total amount of local storage required for this EmptyDir volume.
The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod.
EnvValueFromConfigMapOptions ¶
Options to specify an envionment variable value from a ConfigMap key.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValueFromConfigMapOptions(
optional: bool = None
)
optional
Optional ¶
optional: bool
- Type:
bool
- Default: false
Specify whether the ConfigMap or its key must be defined.
EnvValueFromFieldRefOptions ¶
Options to specify an environment variable value from a field reference.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValueFromFieldRefOptions(
api_version: str = None,
key: str = None
)
api_version
Optional ¶
api_version: str
- Type:
str
Version of the schema the FieldPath is written in terms of.
key
Optional ¶
key: str
- Type:
str
The key to select the pod label or annotation.
EnvValueFromProcessOptions ¶
Options to specify an environment variable value from the process environment.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValueFromProcessOptions(
required: bool = None
)
required
Optional ¶
required: bool
- Type:
bool
- Default: false
Specify whether the key must exist in the environment.
If this is set to true, and the key does not exist, an error will thrown.
EnvValueFromResourceOptions ¶
Options to specify an environment variable value from a resource.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValueFromResourceOptions(
container: Container = None,
divisor: str = None
)
container
Optional ¶
container: Container
- Type:
cdk8s_plus_30.Container
The container to select the value from.
divisor
Optional ¶
divisor: str
- Type:
str
The output format of the exposed resource.
EnvValueFromSecretOptions ¶
Options to specify an environment variable value from a Secret.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValueFromSecretOptions(
optional: bool = None
)
optional
Optional ¶
optional: bool
- Type:
bool
- Default: false
Specify whether the Secret or its key must be defined.
EphemeralStorageResources ¶
Emphemeral storage request and limit.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.EphemeralStorageResources(
limit: Size = None,
request: Size = None
)
limit
Optional ¶
limit: Size
- Type:
cdk8s.Size
request
Optional ¶
request: Size
- Type:
cdk8s.Size
ExposeDeploymentViaIngressOptions ¶
Options for exposing a deployment via an ingress.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ExposeDeploymentViaIngressOptions(
name: str = None,
ports: typing.List[ServicePort] = None,
service_type: ServiceType = None,
ingress: Ingress = None,
path_type: HttpIngressPathType = None
)
name
Optional ¶
name: str
- Type:
str
- Default: auto generated.
The name of the service to expose.
If you’d like to expose the deployment multiple times, you must explicitly set a name starting from the second expose call.
ports
Optional ¶
ports: typing.List[ServicePort]
- Type: typing.List[
cdk8s_plus_30.ServicePort
] - Default: extracted from the deployment.
The ports that the service should bind to.
service_type
Optional ¶
service_type: ServiceType
- Type:
cdk8s_plus_30.ServiceType
- Default: ClusterIP.
The type of the exposed service.
ingress
Optional ¶
ingress: Ingress
- Type:
cdk8s_plus_30.Ingress
- Default: An ingress will be automatically created.
The ingress to add rules to.
path_type
Optional ¶
path_type: HttpIngressPathType
- Type:
cdk8s_plus_30.HttpIngressPathType
- Default: HttpIngressPathType.PREFIX
The type of the path.
ExposeServiceViaIngressOptions ¶
Options for exposing a service using an ingress.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ExposeServiceViaIngressOptions(
ingress: Ingress = None,
path_type: HttpIngressPathType = None
)
ingress
Optional ¶
ingress: Ingress
- Type:
cdk8s_plus_30.Ingress
- Default: An ingress will be automatically created.
The ingress to add rules to.
path_type
Optional ¶
path_type: HttpIngressPathType
- Type:
cdk8s_plus_30.HttpIngressPathType
- Default: HttpIngressPathType.PREFIX
The type of the path.
FromServiceAccountNameOptions ¶
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.FromServiceAccountNameOptions(
namespace_name: str = None
)
namespace_name
Optional ¶
namespace_name: str
- Type:
str
- Default: “default”
The name of the namespace the service account belongs to.
GCEPersistentDiskPersistentVolumeProps ¶
Properties for GCEPersistentDiskPersistentVolume
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.GCEPersistentDiskPersistentVolumeProps(
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
claim: IPersistentVolumeClaim = None,
mount_options: typing.List[str] = None,
reclaim_policy: PersistentVolumeReclaimPolicy = None,
storage: Size = None,
storage_class_name: str = None,
volume_mode: PersistentVolumeMode = None,
pd_name: str,
fs_type: str = None,
partition: typing.Union[int, float] = None,
read_only: bool = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
access_modes: typing.List[PersistentVolumeAccessMode]
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes.
Contains all ways the volume can be mounted.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes
claim
Optional ¶
claim: IPersistentVolumeClaim
- Type:
cdk8s_plus_30.IPersistentVolumeClaim
- Default: Not bound to a specific claim.
Part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
Expected to be non-nil when bound.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding
mount_options
Optional ¶
mount_options: typing.List[str]
- Type: typing.List[
str
] - Default: No options.
A list of mount options, e.g. [“ro”, “soft”]. Not validated - mount will simply fail if one is invalid.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
reclaim_policy
Optional ¶
reclaim_policy: PersistentVolumeReclaimPolicy
- Type:
cdk8s_plus_30.PersistentVolumeReclaimPolicy
- Default: PersistentVolumeReclaimPolicy.RETAIN
When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource.
The reclaim policy tells the cluster what to do with the volume after it has been released of its claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming
storage
Optional ¶
storage: Size
- Type:
cdk8s.Size
- Default: No specified.
What is the storage capacity of this volume.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
storage_class_name: str
- Type:
str
- Default: Volume does not belong to any storage class.
Name of StorageClass to which this persistent volume belongs.
volume_mode
Optional ¶
volume_mode: PersistentVolumeMode
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
pd_name
Required ¶
pd_name: str
- Type:
str
Unique name of the PD resource in GCE.
Used to identify the disk in GCE.
https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk
fs_type
Optional ¶
fs_type: str
- Type:
str
- Default: ‘ext4’
Filesystem type of the volume that you want to mount.
Tip: Ensure that the filesystem type is supported by the host operating system.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
partition
Optional ¶
partition: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: No partition.
The partition in the volume that you want to mount.
If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as “1”. Similarly, the volume partition for /dev/sda is “0” (or you can leave the property empty).
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Specify “true” to force and set the ReadOnly property in VolumeMounts to “true”.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
GCEPersistentDiskVolumeOptions ¶
Options of Volume.fromGcePersistentDisk
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.GCEPersistentDiskVolumeOptions(
fs_type: str = None,
name: str = None,
partition: typing.Union[int, float] = None,
read_only: bool = None
)
fs_type
Optional ¶
fs_type: str
- Type:
str
- Default: ‘ext4’
Filesystem type of the volume that you want to mount.
Tip: Ensure that the filesystem type is supported by the host operating system.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
name
Optional ¶
name: str
- Type:
str
- Default: auto-generated
The volume name.
partition
Optional ¶
partition: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: No partition.
The partition in the volume that you want to mount.
If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as “1”. Similarly, the volume partition for /dev/sda is “0” (or you can leave the property empty).
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Specify “true” to force and set the ReadOnly property in VolumeMounts to “true”.
https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
HandlerFromHttpGetOptions ¶
Options for Handler.fromHttpGet
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.HandlerFromHttpGetOptions(
port: typing.Union[int, float] = None
)
port
Optional ¶
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: defaults to
container.port
.
The TCP port to use when sending the GET request.
HandlerFromTcpSocketOptions ¶
Options for Handler.fromTcpSocket
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.HandlerFromTcpSocketOptions(
host: str = None,
port: typing.Union[int, float] = None
)
host
Optional ¶
host: str
- Type:
str
- Default: defaults to the pod IP
The host name to connect to on the container.
port
Optional ¶
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: defaults to
container.port
.
The TCP port to connect to on the container.
HorizontalPodAutoscalerProps ¶
Properties for HorizontalPodAutoscaler.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.HorizontalPodAutoscalerProps(
metadata: ApiObjectMetadata = None,
max_replicas: typing.Union[int, float],
target: IScalable,
metrics: typing.List[Metric] = None,
min_replicas: typing.Union[int, float] = None,
scale_down: ScalingRules = None,
scale_up: ScalingRules = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
max_replicas
Required ¶
max_replicas: typing.Union[int, float]
- Type:
typing.Union[int, float]
The maximum number of replicas that can be scaled up to.
target
Required ¶
target: IScalable
- Type:
cdk8s_plus_30.IScalable
The workload to scale up or down.
Scalable workload types:
- Deployment
- StatefulSet
metrics
Optional ¶
metrics: typing.List[Metric]
- Type: typing.List[
cdk8s_plus_30.Metric
] - Default: If metrics are not provided, then the target resource constraints (e.g. cpu limit) will be used as scaling metrics.
The metric conditions that trigger a scale up or scale down.
min_replicas
Optional ¶
min_replicas: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 1
The minimum number of replicas that can be scaled down to.
Can be set to 0 if the alpha feature gate HPAScaleToZero
is enabled and
at least one Object or External metric is configured.
scale_down
Optional ¶
scale_down: ScalingRules
- Type:
cdk8s_plus_30.ScalingRules
- Default: Scale down to minReplica count with a 5 minute stabilization window.
The scaling behavior when scaling down.
scale_up
Optional ¶
scale_up: ScalingRules
- Type:
cdk8s_plus_30.ScalingRules
- Default: Is the higher of:
- Increase no more than 4 pods per 60 seconds
- Double the number of pods per 60 seconds
The scaling behavior when scaling up.
HostAlias ¶
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s /etc/hosts file.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.HostAlias(
hostnames: typing.List[str],
ip: str
)
hostnames
Required ¶
hostnames: typing.List[str]
- Type: typing.List[
str
]
Hostnames for the chosen IP address.
ip
Required ¶
ip: str
- Type:
str
IP address of the host file entry.
HostPathVolumeOptions ¶
Options for a HostPathVolume-based volume.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.HostPathVolumeOptions(
path: str,
type: HostPathVolumeType = None
)
path
Required ¶
path: str
- Type:
str
The path of the directory on the host.
type
Optional ¶
type: HostPathVolumeType
- Type:
cdk8s_plus_30.HostPathVolumeType
- Default: HostPathVolumeType.DEFAULT
The expected type of the path found on the host.
HttpGetProbeOptions ¶
Options for Probe.fromHttpGet()
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.HttpGetProbeOptions(
failure_threshold: typing.Union[int, float] = None,
initial_delay_seconds: Duration = None,
period_seconds: Duration = None,
success_threshold: typing.Union[int, float] = None,
timeout_seconds: Duration = None,
host: str = None,
port: typing.Union[int, float] = None,
scheme: ConnectionScheme = None
)
failure_threshold
Optional ¶
failure_threshold: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 3
Minimum consecutive failures for the probe to be considered failed after having succeeded.
Defaults to 3. Minimum value is 1.
initial_delay_seconds
Optional ¶
initial_delay_seconds: Duration
- Type:
cdk8s.Duration
- Default: immediate
Number of seconds after the container has started before liveness probes are initiated.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
period_seconds
Optional ¶
period_seconds: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(10) Minimum value is 1.
How often (in seconds) to perform the probe.
Default to 10 seconds. Minimum value is 1.
success_threshold
Optional ¶
success_threshold: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 1 Must be 1 for liveness and startup. Minimum value is 1.
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.
timeout_seconds
Optional ¶
timeout_seconds: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(1)
Number of seconds after which the probe times out.
Defaults to 1 second. Minimum value is 1.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
host
Optional ¶
host: str
- Type:
str
- Default: defaults to the pod IP
The host name to connect to on the container.
port
Optional ¶
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: defaults to
container.port
.
The TCP port to use when sending the GET request.
scheme
Optional ¶
scheme: ConnectionScheme
- Type:
cdk8s_plus_30.ConnectionScheme
- Default: ConnectionScheme.HTTP
Scheme to use for connecting to the host (HTTP or HTTPS).
IngressProps ¶
Properties for Ingress
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.IngressProps(
metadata: ApiObjectMetadata = None,
class_name: str = None,
default_backend: IngressBackend = None,
rules: typing.List[IngressRule] = None,
tls: typing.List[IngressTls] = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
class_name
Optional ¶
class_name: str
- Type:
str
Class Name for this ingress.
This field is a reference to an IngressClass resource that contains additional Ingress configuration, including the name of the Ingress controller.
default_backend
Optional ¶
default_backend: IngressBackend
The default backend services requests that do not match any rule.
Using this option or the addDefaultBackend()
method is equivalent to
adding a rule with both path
and host
undefined.
rules
Optional ¶
rules: typing.List[IngressRule]
- Type: typing.List[
cdk8s_plus_30.IngressRule
]
Routing rules for this ingress.
Each rule must define an IngressBackend
that will receive the requests
that match this rule. If both host
and path
are not specifiec, this
backend will be used as the default backend of the ingress.
You can also add rules later using addRule()
, addHostRule()
,
addDefaultBackend()
and addHostDefaultBackend()
.
tls
Optional ¶
tls: typing.List[IngressTls]
- Type: typing.List[
cdk8s_plus_30.IngressTls
]
TLS settings for this ingress.
Using this option tells the ingress controller to expose a TLS endpoint. Currently the Ingress only supports a single TLS port, 443. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension, if the ingress controller fulfilling the ingress supports SNI.
IngressRule ¶
Represents the rules mapping the paths under a specified host to the related backend services.
Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching path.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.IngressRule(
backend: IngressBackend,
host: str = None,
path: str = None,
path_type: HttpIngressPathType = None
)
backend
Required ¶
backend: IngressBackend
Backend defines the referenced service endpoint to which the traffic will be forwarded to.
host
Optional ¶
host: str
- Type:
str
- Default: If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue.
Host is the fully qualified domain name of a network host, as defined by RFC 3986.
Note the following deviations from the “host” part of the URI as
defined in the RFC: 1. IPs are not allowed. Currently an IngressRuleValue
can only apply to the IP in the Spec of the parent Ingress. 2. The :
delimiter is not respected because ports are not allowed. Currently the
port of an Ingress is implicitly :80 for http and :443 for https. Both
these may change in the future. Incoming requests are matched against the
host before the IngressRuleValue.
path
Optional ¶
path: str
- Type:
str
- Default: If unspecified, the path defaults to a catch all sending traffic to the backend.
Path is an extended POSIX regex as defined by IEEE Std 1003.1, (i.e this follows the egrep/unix syntax, not the perl syntax) matched against the path of an incoming request. Currently it can contain characters disallowed from the conventional “path” part of a URL as defined by RFC 3986. Paths must begin with a ‘/’.
path_type
Optional ¶
path_type: HttpIngressPathType
Specify how the path is matched against request paths.
By default, path types will be matched by prefix.
https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
IngressTls ¶
Represents the TLS configuration mapping that is passed to the ingress controller for SSL termination.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.IngressTls(
hosts: typing.List[str] = None,
secret: ISecret = None
)
hosts
Optional ¶
hosts: typing.List[str]
- Type: typing.List[
str
] - Default: If unspecified, it defaults to the wildcard host setting for the loadbalancer controller fulfilling this Ingress.
Hosts are a list of hosts included in the TLS certificate.
The values in this list must match the name/s used in the TLS Secret.
secret
Optional ¶
secret: ISecret
- Type:
cdk8s_plus_30.ISecret
- Default: If unspecified, it allows SSL routing based on SNI hostname.
Secret is the secret that contains the certificate and key used to terminate SSL traffic on 443.
If the SNI host in a listener conflicts with the “Host” header field used by an IngressRule, the SNI host is used for termination and value of the Host header is used for routing.
JobProps ¶
Properties for Job
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.JobProps(
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
active_deadline: Duration = None,
backoff_limit: typing.Union[int, float] = None,
ttl_after_finished: Duration = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
automount_service_account_token: bool
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
dns: PodDnsProps
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
docker_registry_auth: ISecret
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
host_aliases: typing.List[HostAlias]
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
host_network: bool
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
init_containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
isolate: bool
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
restart_policy: RestartPolicy
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
security_context: PodSecurityContextProps
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
service_account: IServiceAccount
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
termination_grace_period: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
volumes: typing.List[Volume]
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
pod_metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
select: bool
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
spread: bool
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
active_deadline
Optional ¶
active_deadline: Duration
- Type:
cdk8s.Duration
- Default: If unset, then there is no deadline.
Specifies the duration the job may be active before the system tries to terminate it.
backoff_limit
Optional ¶
backoff_limit: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: If not set, system defaults to 6.
Specifies the number of retries before marking this job failed.
ttl_after_finished
Optional ¶
ttl_after_finished: Duration
- Type:
cdk8s.Duration
- Default: If this field is unset, the Job won’t be automatically deleted.
Limits the lifetime of a Job that has finished execution (either Complete or Failed).
If this field is set, after the Job finishes, it is eligible to
be automatically deleted. When the Job is being deleted, its lifecycle
guarantees (e.g. finalizers) will be honored. If this field is set to zero,
the Job becomes eligible to be deleted immediately after it finishes. This
field is alpha-level and is only honored by servers that enable the
TTLAfterFinished
feature.
LabelSelectorOptions ¶
Options for LabelSelector.of
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.LabelSelectorOptions(
expressions: typing.List[LabelExpression] = None,
labels: typing.Mapping[str] = None
)
expressions
Optional ¶
expressions: typing.List[LabelExpression]
- Type: typing.List[
cdk8s_plus_30.LabelExpression
]
Expression based label matchers.
labels
Optional ¶
labels: typing.Mapping[str]
- Type: typing.Mapping[
str
]
Strict label matchers.
LabelSelectorRequirement ¶
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.LabelSelectorRequirement(
key: str,
operator: str,
values: typing.List[str] = None
)
key
Required ¶
key: str
- Type:
str
The label key that the selector applies to.
operator
Required ¶
operator: str
- Type:
str
Represents a key’s relationship to a set of values.
values
Optional ¶
values: typing.List[str]
- Type: typing.List[
str
]
An array of string values.
If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
MemoryResources ¶
Memory request and limit.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.MemoryResources(
limit: Size = None,
request: Size = None
)
limit
Optional ¶
limit: Size
- Type:
cdk8s.Size
request
Optional ¶
request: Size
- Type:
cdk8s.Size
MetricContainerResourceOptions ¶
Options for Metric.containerResource()
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.MetricContainerResourceOptions(
container: Container,
target: MetricTarget
)
container
Required ¶
container: Container
- Type:
cdk8s_plus_30.Container
Container where the metric can be found.
target
Required ¶
target: MetricTarget
Target metric value that will trigger scaling.
MetricObjectOptions ¶
Options for Metric.object()
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.MetricObjectOptions(
name: str,
target: MetricTarget,
label_selector: LabelSelector = None,
object: IResource
)
name
Required ¶
name: str
- Type:
str
The name of the metric to scale on.
target
Required ¶
target: MetricTarget
The target metric value that will trigger scaling.
label_selector
Optional ¶
label_selector: LabelSelector
- Type:
cdk8s_plus_30.LabelSelector
- Default: Just the metric ‘name’ will be used to gather metrics.
A selector to find a metric by label.
When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping.
object
Required ¶
object: IResource
- Type:
cdk8s_plus_30.IResource
Resource where the metric can be found.
MetricOptions ¶
Base options for a Metric.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.MetricOptions(
name: str,
target: MetricTarget,
label_selector: LabelSelector = None
)
name
Required ¶
name: str
- Type:
str
The name of the metric to scale on.
target
Required ¶
target: MetricTarget
The target metric value that will trigger scaling.
label_selector
Optional ¶
label_selector: LabelSelector
- Type:
cdk8s_plus_30.LabelSelector
- Default: Just the metric ‘name’ will be used to gather metrics.
A selector to find a metric by label.
When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping.
MountOptions ¶
Options for mounts.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.MountOptions(
propagation: MountPropagation = None,
read_only: bool = None,
sub_path: str = None,
sub_path_expr: str = None
)
propagation
Optional ¶
propagation: MountPropagation
- Type:
cdk8s_plus_30.MountPropagation
- Default: MountPropagation.NONE
Determines how mounts are propagated from the host to container and the other way around.
When not set, MountPropagationNone is used.
Mount propagation allows for sharing volumes mounted by a Container to other Containers in the same Pod, or even to other Pods on the same node.
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Mounted read-only if true, read-write otherwise (false or unspecified).
Defaults to false.
sub_path
Optional ¶
sub_path: str
- Type:
str
- Default: “” the volume’s root
Path within the volume from which the container’s volume should be mounted.).
sub_path_expr
Optional ¶
sub_path_expr: str
- Type:
str
- Default: “” volume’s root.
Expanded path within the volume from which the container’s volume should be mounted.
Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container’s environment. Defaults to “” (volume’s root).
subPathExpr
and subPath
are mutually exclusive.
NamespaceProps ¶
Properties for Namespace
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NamespaceProps(
metadata: ApiObjectMetadata = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
NamespaceSelectorConfig ¶
Configuration for selecting namespaces.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NamespaceSelectorConfig(
label_selector: LabelSelector = None,
names: typing.List[str] = None
)
label_selector
Optional ¶
label_selector: LabelSelector
A selector to select namespaces by labels.
names
Optional ¶
names: typing.List[str]
- Type: typing.List[
str
]
A list of names to select namespaces by names.
NamespacesSelectOptions ¶
Options for Namespaces.select
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NamespacesSelectOptions(
expressions: typing.List[LabelExpression] = None,
labels: typing.Mapping[str] = None,
names: typing.List[str] = None
)
expressions
Optional ¶
expressions: typing.List[LabelExpression]
- Type: typing.List[
cdk8s_plus_30.LabelExpression
] - Default: no selector requirements.
Namespaces must satisfy these selectors.
The selectors query labels, just like the labels
property, but they
provide a more advanced matching mechanism.
labels
Optional ¶
labels: typing.Mapping[str]
- Type: typing.Mapping[
str
] - Default: no strict labels requirements.
Labels the namespaces must have.
This is equivalent to using an ‘Is’ selector.
names
Optional ¶
names: typing.List[str]
- Type: typing.List[
str
] - Default: no name requirements.
Namespaces names must be one of these.
NetworkPolicyAddEgressRuleOptions ¶
Options for NetworkPolicy.addEgressRule
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyAddEgressRuleOptions(
ports: typing.List[NetworkPolicyPort] = None
)
ports
Optional ¶
ports: typing.List[NetworkPolicyPort]
- Type: typing.List[
cdk8s_plus_30.NetworkPolicyPort
] - Default: If the peer is a managed pod, take its ports. Otherwise, all ports are allowed.
Ports the rule should allow outgoing traffic to.
NetworkPolicyPeerConfig ¶
Configuration for network peers.
A peer can either by an ip block, or a selection of pods, not both.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyPeerConfig(
ip_block: NetworkPolicyIpBlock = None,
pod_selector: PodSelectorConfig = None
)
ip_block
Optional ¶
ip_block: NetworkPolicyIpBlock
The ip block this peer represents.
pod_selector
Optional ¶
pod_selector: PodSelectorConfig
The pod selector this peer represents.
NetworkPolicyPortProps ¶
Properties for NetworkPolicyPort
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyPortProps(
end_port: typing.Union[int, float] = None,
port: typing.Union[int, float] = None,
protocol: NetworkProtocol = None
)
end_port
Optional ¶
end_port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: not a port range.
End port (relative to port
).
Only applies if port
is defined.
Use this to specify a port range, rather that a specific one.
port
Optional ¶
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: all ports are allowed.
Specific port number.
protocol
Optional ¶
protocol: NetworkProtocol
- Type:
cdk8s_plus_30.NetworkProtocol
- Default: NetworkProtocol.TCP
Protocol.
NetworkPolicyProps ¶
Properties for NetworkPolicy
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyProps(
metadata: ApiObjectMetadata = None,
egress: NetworkPolicyTraffic = None,
ingress: NetworkPolicyTraffic = None,
selector: IPodSelector = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
egress
Optional ¶
egress: NetworkPolicyTraffic
- Type:
cdk8s_plus_30.NetworkPolicyTraffic
- Default: the policy doesn’t change egress behavior of the pods it selects.
Egress traffic configuration.
ingress
Optional ¶
ingress: NetworkPolicyTraffic
- Type:
cdk8s_plus_30.NetworkPolicyTraffic
- Default: the policy doesn’t change ingress behavior of the pods it selects.
Ingress traffic configuration.
selector
Optional ¶
selector: IPodSelector
- Type:
cdk8s_plus_30.IPodSelector
- Default: will select all pods in the namespace of the policy.
Which pods does this policy object applies to.
This can either be a single pod / workload, or a grouping of pods selected
via the Pods.select
function. Rules is applied to any pods selected by this property.
Multiple network policies can select the same set of pods.
In this case, the rules for each are combined additively.
Note that
NetworkPolicyRule ¶
Describes a rule allowing traffic from / to pods matched by a network policy selector.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyRule(
peer: INetworkPolicyPeer,
ports: typing.List[NetworkPolicyPort] = None
)
peer
Required ¶
peer: INetworkPolicyPeer
Peer this rule interacts with.
ports
Optional ¶
ports: typing.List[NetworkPolicyPort]
- Type: typing.List[
cdk8s_plus_30.NetworkPolicyPort
] - Default: traffic is allowed on all ports.
The ports of the rule.
NetworkPolicyTraffic ¶
Describes how the network policy should configure egress / ingress traffic.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyTraffic(
default: NetworkPolicyTrafficDefault = None,
rules: typing.List[NetworkPolicyRule] = None
)
default
Optional ¶
default: NetworkPolicyTrafficDefault
- Type:
cdk8s_plus_30.NetworkPolicyTrafficDefault
- Default: unset, the policy does not change the behavior.
Specifies the default behavior of the policy when no rules are defined.
rules
Optional ¶
rules: typing.List[NetworkPolicyRule]
- Type: typing.List[
cdk8s_plus_30.NetworkPolicyRule
] - Default: no rules
List of rules to be applied to the selected pods.
If empty, the behavior of the policy is dictated by the default
property.
NfsVolumeOptions ¶
Options for the NFS based volume.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NfsVolumeOptions(
path: str,
server: str,
read_only: bool = None
)
path
Required ¶
path: str
- Type:
str
Path that is exported by the NFS server.
server
Required ¶
server: str
- Type:
str
Server is the hostname or IP address of the NFS server.
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
If set to true, will force the NFS export to be mounted with read-only permissions.
NodeTaintQueryOptions ¶
Options for NodeTaintQuery
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.NodeTaintQueryOptions(
effect: TaintEffect = None,
evict_after: Duration = None
)
effect
Optional ¶
effect: TaintEffect
- Type:
cdk8s_plus_30.TaintEffect
- Default: all effects are matched.
The taint effect to match.
evict_after
Optional ¶
evict_after: Duration
- Type:
cdk8s.Duration
- Default: bound forever.
How much time should a pod that tolerates the NO_EXECUTE
effect be bound to the node.
Only applies for the NO_EXECUTE
effect.
PathMapping ¶
Maps a string key to a path within a volume.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PathMapping(
path: str,
mode: typing.Union[int, float] = None
)
path
Required ¶
path: str
- Type:
str
The relative path of the file to map the key to.
May not be an absolute path. May not contain the path element ‘..’. May not start with the string ‘..’.
mode
Optional ¶
mode: typing.Union[int, float]
- Type:
typing.Union[int, float]
Optional: mode bits to use on this file, must be a value between 0 and 0777.
If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
PersistentVolumeClaimProps ¶
Properties for PersistentVolumeClaim
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PersistentVolumeClaimProps(
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
storage: Size = None,
storage_class_name: str = None,
volume: IPersistentVolume = None,
volume_mode: PersistentVolumeMode = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
access_modes: typing.List[PersistentVolumeAccessMode]
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes requirement.
Contains the access modes the volume should support.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1
storage
Optional ¶
storage: Size
- Type:
cdk8s.Size
- Default: No storage requirement.
Minimum storage size the volume should have.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
storage_class_name: str
- Type:
str
- Default: Not set.
Name of the StorageClass required by the claim. When this property is not set, the behavior is as follows:.
- If the admission plugin is turned on, the storage class marked as default will be used.
- If the admission plugin is turned off, the pvc can only be bound to volumes without a storage class.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1
volume
Optional ¶
volume: IPersistentVolume
- Type:
cdk8s_plus_30.IPersistentVolume
- Default: No specific volume binding.
The PersistentVolume backing this claim.
The control plane still checks that storage class, access modes, and requested storage size on the volume are valid.
Note that in order to guarantee a proper binding, the volume should
also define a claimRef
referring to this claim. Otherwise, the volume may be
claimed be other pvc’s before it gets a chance to bind to this one.
If the volume is managed (i.e not imported), you can use pv.claim()
to easily
create a bi-directional bounded claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#binding.
volume_mode
Optional ¶
volume_mode: PersistentVolumeMode
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
PersistentVolumeClaimVolumeOptions ¶
Options for a PersistentVolumeClaim-based volume.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PersistentVolumeClaimVolumeOptions(
name: str = None,
read_only: bool = None
)
name
Optional ¶
name: str
- Type:
str
- Default: Derived from the PVC name.
The volume name.
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Will force the ReadOnly setting in VolumeMounts.
PersistentVolumeProps ¶
Properties for PersistentVolume
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PersistentVolumeProps(
metadata: ApiObjectMetadata = None,
access_modes: typing.List[PersistentVolumeAccessMode] = None,
claim: IPersistentVolumeClaim = None,
mount_options: typing.List[str] = None,
reclaim_policy: PersistentVolumeReclaimPolicy = None,
storage: Size = None,
storage_class_name: str = None,
volume_mode: PersistentVolumeMode = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
access_modes
Optional ¶
access_modes: typing.List[PersistentVolumeAccessMode]
- Type: typing.List[
cdk8s_plus_30.PersistentVolumeAccessMode
] - Default: No access modes.
Contains all ways the volume can be mounted.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes
claim
Optional ¶
claim: IPersistentVolumeClaim
- Type:
cdk8s_plus_30.IPersistentVolumeClaim
- Default: Not bound to a specific claim.
Part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
Expected to be non-nil when bound.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding
mount_options
Optional ¶
mount_options: typing.List[str]
- Type: typing.List[
str
] - Default: No options.
A list of mount options, e.g. [“ro”, “soft”]. Not validated - mount will simply fail if one is invalid.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
reclaim_policy
Optional ¶
reclaim_policy: PersistentVolumeReclaimPolicy
- Type:
cdk8s_plus_30.PersistentVolumeReclaimPolicy
- Default: PersistentVolumeReclaimPolicy.RETAIN
When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource.
The reclaim policy tells the cluster what to do with the volume after it has been released of its claim.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming
storage
Optional ¶
storage: Size
- Type:
cdk8s.Size
- Default: No specified.
What is the storage capacity of this volume.
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
storage_class_name
Optional ¶
storage_class_name: str
- Type:
str
- Default: Volume does not belong to any storage class.
Name of StorageClass to which this persistent volume belongs.
volume_mode
Optional ¶
volume_mode: PersistentVolumeMode
- Type:
cdk8s_plus_30.PersistentVolumeMode
- Default: VolumeMode.FILE_SYSTEM
Defines what type of volume is required by the claim.
PodConnectionsAllowFromOptions ¶
Options for PodConnections.allowFrom
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodConnectionsAllowFromOptions(
isolation: PodConnectionsIsolation = None,
ports: typing.List[NetworkPolicyPort] = None
)
isolation
Optional ¶
isolation: PodConnectionsIsolation
- Type:
cdk8s_plus_30.PodConnectionsIsolation
- Default: unset, isolates both the pod and the peer.
Which isolation should be applied to establish the connection.
ports
Optional ¶
ports: typing.List[NetworkPolicyPort]
- Type: typing.List[
cdk8s_plus_30.NetworkPolicyPort
] - Default: The pod ports.
Ports to allow incoming traffic to.
PodConnectionsAllowToOptions ¶
Options for PodConnections.allowTo
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodConnectionsAllowToOptions(
isolation: PodConnectionsIsolation = None,
ports: typing.List[NetworkPolicyPort] = None
)
isolation
Optional ¶
isolation: PodConnectionsIsolation
- Type:
cdk8s_plus_30.PodConnectionsIsolation
- Default: unset, isolates both the pod and the peer.
Which isolation should be applied to establish the connection.
ports
Optional ¶
ports: typing.List[NetworkPolicyPort]
- Type: typing.List[
cdk8s_plus_30.NetworkPolicyPort
] - Default: If the peer is a managed pod, take its ports. Otherwise, all ports are allowed.
Ports to allow outgoing traffic to.
PodDnsProps ¶
Properties for PodDns
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodDnsProps(
hostname: str = None,
hostname_as_fqd_n: bool = None,
nameservers: typing.List[str] = None,
options: typing.List[DnsOption] = None,
policy: DnsPolicy = None,
searches: typing.List[str] = None,
subdomain: str = None
)
hostname
Optional ¶
hostname: str
- Type:
str
- Default: Set to a system-defined value.
Specifies the hostname of the Pod.
hostname_as_fqd_n
Optional ¶
hostname_as_fqd_n: bool
- Type:
bool
- Default: false
If true the pod’s hostname will be configured as the pod’s FQDN, rather than the leaf name (the default).
In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters to FQDN. If a pod does not have FQDN, this has no effect.
nameservers
Optional ¶
nameservers: typing.List[str]
- Type: typing.List[
str
]
A list of IP addresses that will be used as DNS servers for the Pod.
There can be at most 3 IP addresses specified. When the policy is set to “NONE”, the list must contain at least one IP address, otherwise this property is optional. The servers listed will be combined to the base nameservers generated from the specified DNS policy with duplicate addresses removed.
options
Optional ¶
options: typing.List[DnsOption]
- Type: typing.List[
cdk8s_plus_30.DnsOption
]
List of objects where each object may have a name property (required) and a value property (optional).
The contents in this property will be merged to the options generated from the specified DNS policy. Duplicate entries are removed.
policy
Optional ¶
policy: DnsPolicy
- Type:
cdk8s_plus_30.DnsPolicy
- Default: DnsPolicy.CLUSTER_FIRST
Set DNS policy for the pod.
If policy is set to None
, other configuration must be supplied.
searches
Optional ¶
searches: typing.List[str]
- Type: typing.List[
str
]
A list of DNS search domains for hostname lookup in the Pod.
When specified, the provided list will be merged into the base search domain names generated from the chosen DNS policy. Duplicate domain names are removed.
Kubernetes allows for at most 6 search domains.
subdomain
Optional ¶
subdomain: str
- Type:
str
- Default: No subdomain.
If specified, the fully qualified Pod hostname will be “
PodProps ¶
Properties for Pod
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodProps(
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
automount_service_account_token: bool
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
dns: PodDnsProps
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
docker_registry_auth: ISecret
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
host_aliases: typing.List[HostAlias]
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
host_network: bool
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
init_containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
isolate: bool
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
restart_policy: RestartPolicy
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
security_context: PodSecurityContextProps
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
service_account: IServiceAccount
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
termination_grace_period: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
volumes: typing.List[Volume]
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
PodsAllOptions ¶
Options for Pods.all
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodsAllOptions(
namespaces: Namespaces = None
)
namespaces
Optional ¶
namespaces: Namespaces
- Type:
cdk8s_plus_30.Namespaces
- Default: unset, implies the namespace of the resource this selection is used in.
Namespaces the pods are allowed to be in.
Use Namespaces.all()
to allow all namespaces.
PodSchedulingAttractOptions ¶
Options for PodScheduling.attract
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodSchedulingAttractOptions(
weight: typing.Union[int, float] = None
)
weight
Optional ¶
weight: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: no weight. assignment is assumed to be required (hard).
Indicates the attraction is optional (soft), with this weight score.
PodSchedulingColocateOptions ¶
Options for PodScheduling.colocate
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodSchedulingColocateOptions(
topology: Topology = None,
weight: typing.Union[int, float] = None
)
topology
Optional ¶
topology: Topology
- Type:
cdk8s_plus_30.Topology
- Default: Topology.HOSTNAME
Which topology to coloate on.
weight
Optional ¶
weight: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: no weight. co-location is assumed to be required (hard).
Indicates the co-location is optional (soft), with this weight score.
PodSchedulingSeparateOptions ¶
Options for PodScheduling.separate
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodSchedulingSeparateOptions(
topology: Topology = None,
weight: typing.Union[int, float] = None
)
topology
Optional ¶
topology: Topology
- Type:
cdk8s_plus_30.Topology
- Default: Topology.HOSTNAME
Which topology to separate on.
weight
Optional ¶
weight: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: no weight. separation is assumed to be required (hard).
Indicates the separation is optional (soft), with this weight score.
PodSecurityContextProps ¶
Properties for PodSecurityContext
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodSecurityContextProps(
ensure_non_root: bool = None,
fs_group: typing.Union[int, float] = None,
fs_group_change_policy: FsGroupChangePolicy = None,
group: typing.Union[int, float] = None,
sysctls: typing.List[Sysctl] = None,
user: typing.Union[int, float] = None
)
ensure_non_root
Optional ¶
ensure_non_root: bool
- Type:
bool
- Default: true
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.
fs_group
Optional ¶
fs_group: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: Volume ownership is not changed.
Modify the ownership and permissions of pod volumes to this GID.
fs_group_change_policy
Optional ¶
fs_group_change_policy: FsGroupChangePolicy
- Type:
cdk8s_plus_30.FsGroupChangePolicy
- Default: FsGroupChangePolicy.ALWAYS
Defines behavior of changing ownership and permission of the volume before being exposed inside Pod.
This field will only apply to volume types which support fsGroup based ownership(and permissions). It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir.
group
Optional ¶
group: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: Group configured by container runtime
The GID to run the entrypoint of the container process.
sysctls
Optional ¶
sysctls: typing.List[Sysctl]
- Type: typing.List[
cdk8s_plus_30.Sysctl
] - Default: No sysctls
Sysctls hold a list of namespaced sysctls used for the pod.
Pods with unsupported sysctls (by the container runtime) might fail to launch.
user
Optional ¶
user: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: User specified in image metadata
The UID to run the entrypoint of the container process.
PodSelectorConfig ¶
Configuration for selecting pods, optionally in particular namespaces.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodSelectorConfig(
label_selector: LabelSelector,
namespaces: NamespaceSelectorConfig = None
)
label_selector
Required ¶
label_selector: LabelSelector
A selector to select pods by labels.
namespaces
Optional ¶
namespaces: NamespaceSelectorConfig
Configuration for selecting which namepsaces are the pods allowed to be in.
PodsSelectOptions ¶
Options for Pods.select
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.PodsSelectOptions(
expressions: typing.List[LabelExpression] = None,
labels: typing.Mapping[str] = None,
namespaces: Namespaces = None
)
expressions
Optional ¶
expressions: typing.List[LabelExpression]
- Type: typing.List[
cdk8s_plus_30.LabelExpression
] - Default: no expressions requirements.
Expressions the pods must satisify.
labels
Optional ¶
labels: typing.Mapping[str]
- Type: typing.Mapping[
str
] - Default: no strict labels requirements.
Labels the pods must have.
namespaces
Optional ¶
namespaces: Namespaces
- Type:
cdk8s_plus_30.Namespaces
- Default: unset, implies the namespace of the resource this selection is used in.
Namespaces the pods are allowed to be in.
Use Namespaces.all()
to allow all namespaces.
ProbeOptions ¶
Probe options.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ProbeOptions(
failure_threshold: typing.Union[int, float] = None,
initial_delay_seconds: Duration = None,
period_seconds: Duration = None,
success_threshold: typing.Union[int, float] = None,
timeout_seconds: Duration = None
)
failure_threshold
Optional ¶
failure_threshold: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 3
Minimum consecutive failures for the probe to be considered failed after having succeeded.
Defaults to 3. Minimum value is 1.
initial_delay_seconds
Optional ¶
initial_delay_seconds: Duration
- Type:
cdk8s.Duration
- Default: immediate
Number of seconds after the container has started before liveness probes are initiated.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
period_seconds
Optional ¶
period_seconds: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(10) Minimum value is 1.
How often (in seconds) to perform the probe.
Default to 10 seconds. Minimum value is 1.
success_threshold
Optional ¶
success_threshold: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 1 Must be 1 for liveness and startup. Minimum value is 1.
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.
timeout_seconds
Optional ¶
timeout_seconds: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(1)
Number of seconds after which the probe times out.
Defaults to 1 second. Minimum value is 1.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
ResourceProps ¶
Initialization properties for resources.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ResourceProps(
metadata: ApiObjectMetadata = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
RoleBindingProps ¶
Properties for RoleBinding
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.RoleBindingProps(
metadata: ApiObjectMetadata = None,
role: IRole
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
role
Required ¶
role: IRole
- Type:
cdk8s_plus_30.IRole
The role to bind to.
A RoleBinding can reference a Role or a ClusterRole.
RolePolicyRule ¶
Policy rule of a `Role.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.RolePolicyRule(
resources: typing.List[IApiResource],
verbs: typing.List[str]
)
resources
Required ¶
resources: typing.List[IApiResource]
- Type: typing.List[
cdk8s_plus_30.IApiResource
]
Resources this rule applies to.
verbs
Required ¶
verbs: typing.List[str]
- Type: typing.List[
str
]
Verbs to allow.
(e.g [‘get’, ‘watch’])
RoleProps ¶
Properties for Role
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.RoleProps(
metadata: ApiObjectMetadata = None,
rules: typing.List[RolePolicyRule] = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
rules
Optional ¶
rules: typing.List[RolePolicyRule]
- Type: typing.List[
cdk8s_plus_30.RolePolicyRule
] - Default: []
A list of rules the role should allow.
ScalingPolicy ¶
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ScalingPolicy(
replicas: Replicas,
duration: Duration = None
)
replicas
Required ¶
replicas: Replicas
- Type:
cdk8s_plus_30.Replicas
The type and quantity of replicas to change.
duration
Optional ¶
duration: Duration
- Type:
cdk8s.Duration
- Default: 15 seconds
The amount of time the scaling policy has to continue scaling before the target metric must be revalidated.
Must be greater than 0 seconds and no longer than 30 minutes.
ScalingRules ¶
Defines the scaling behavior for one direction.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ScalingRules(
policies: typing.List[ScalingPolicy] = None,
stabilization_window: Duration = None,
strategy: ScalingStrategy = None
)
policies
Optional ¶
policies: typing.List[ScalingPolicy]
- Type: typing.List[
cdk8s_plus_30.ScalingPolicy
] - Default: * Scale up
- Increase no more than 4 pods per 60 seconds
- Double the number of pods per 60 seconds
- Scale down
- Decrease to minReplica count
The scaling policies.
stabilization_window
Optional ¶
stabilization_window: Duration
- Type:
cdk8s.Duration
- Default: * On scale down no stabilization is performed.
- On scale up stabilization is performed for 5 minutes.
Defines the window of past metrics that the autoscaler should consider when calculating wether or not autoscaling should occur.
Minimum duration is 1 second, max is 1 hour.
strategy
Optional ¶
strategy: ScalingStrategy
- Type:
cdk8s_plus_30.ScalingStrategy
- Default: MAX_CHANGE
The strategy to use when scaling.
ScalingTarget ¶
Properties used to configure the target of an Autoscaler.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ScalingTarget(
api_version: str,
containers: typing.List[Container],
kind: str,
name: str,
replicas: typing.Union[int, float] = None
)
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
containers
Required ¶
containers: typing.List[Container]
- Type: typing.List[
cdk8s_plus_30.Container
]
Container definitions associated with the target.
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
name
Required ¶
name: str
- Type:
str
The Kubernetes name of this resource.
replicas
Optional ¶
replicas: typing.Union[int, float]
- Type:
typing.Union[int, float]
The fixed number of replicas defined on the target.
This is used for validation purposes as Scalable targets should not have a fixed number of replicas.
SeccompProfile ¶
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.SeccompProfile(
type: SeccompProfileType,
localhost_profile: str = None
)
type
Required ¶
type: SeccompProfileType
Indicates which kind of seccomp profile will be applied.
localhost_profile
Optional ¶
localhost_profile: str
- Type:
str
- Default: empty string
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”.
SecretProps ¶
Options for Secret
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.SecretProps(
metadata: ApiObjectMetadata = None,
immutable: bool = None,
string_data: typing.Mapping[str] = None,
type: str = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
immutable: bool
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
string_data
Optional ¶
string_data: typing.Mapping[str]
- Type: typing.Mapping[
str
]
stringData allows specifying non-binary secret data in string form.
It is provided as a write-only convenience method. All keys and values are merged into the data field on write, overwriting any existing values. It is never output when reading from the API.
type
Optional ¶
type: str
- Type:
str
- Default: undefined - Don’t set a type.
Optional type associated with the secret.
Used to facilitate programmatic handling of secret data by various controllers.
SecretValue ¶
Represents a specific value in JSON secret.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.SecretValue(
key: str,
secret: ISecret
)
key
Required ¶
key: str
- Type:
str
The JSON key.
secret
Required ¶
secret: ISecret
- Type:
cdk8s_plus_30.ISecret
The secret.
SecretVolumeOptions ¶
Options for the Secret-based volume.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.SecretVolumeOptions(
default_mode: typing.Union[int, float] = None,
items: typing.Mapping[PathMapping] = None,
name: str = None,
optional: bool = None
)
default_mode
Optional ¶
default_mode: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
Mode bits to use on created files by default.
Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
items
Optional ¶
items: typing.Mapping[PathMapping]
- Type: typing.Mapping[
cdk8s_plus_30.PathMapping
] - Default: no mapping
If unspecified, each key-value pair in the Data field of the referenced secret will be projected into the volume as a file whose name is the key and content is the value.
If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the ‘..’ path or start with ‘..’.
name
Optional ¶
name: str
- Type:
str
- Default: auto-generated
The volume name.
optional
Optional ¶
optional: bool
- Type:
bool
- Default: undocumented
Specify whether the secret or its keys must be defined.
ServiceAccountProps ¶
Properties for initialization of ServiceAccount
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ServiceAccountProps(
metadata: ApiObjectMetadata = None,
automount_token: bool = None,
secrets: typing.List[ISecret] = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_token
Optional ¶
automount_token: bool
- Type:
bool
- Default: false
Indicates whether pods running as this service account should have an API token automatically mounted.
Can be overridden at the pod level.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
secrets
Optional ¶
secrets: typing.List[ISecret]
- Type: typing.List[
cdk8s_plus_30.ISecret
]
List of secrets allowed to be used by pods running using this ServiceAccount.
https://kubernetes.io/docs/concepts/configuration/secret
ServiceAccountTokenSecretProps ¶
Options for ServiceAccountTokenSecret
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ServiceAccountTokenSecretProps(
metadata: ApiObjectMetadata = None,
immutable: bool = None,
service_account: IServiceAccount
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
immutable: bool
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
service_account
Required ¶
service_account: IServiceAccount
The service account to store a secret for.
ServiceBindOptions ¶
Options for Service.bind
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ServiceBindOptions(
name: str = None,
node_port: typing.Union[int, float] = None,
protocol: Protocol = None,
target_port: typing.Union[int, float] = None
)
name
Optional ¶
name: str
- Type:
str
The name of this port within the service.
This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. This maps to the ‘Name’ field in EndpointPort objects. Optional if only one ServicePort is defined on this service.
node_port
Optional ¶
node_port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: auto-allocate a port if the ServiceType of this Service requires one.
The port on each node on which this service is exposed when type=NodePort or LoadBalancer.
Usually assigned by the system. If specified, it will be allocated to the service if unused or else creation of the service will fail. Default is to auto-allocate a port if the ServiceType of this Service requires one.
https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
protocol
Optional ¶
protocol: Protocol
- Type:
cdk8s_plus_30.Protocol
- Default: Protocol.TCP
The IP protocol for this port.
Supports “TCP”, “UDP”, and “SCTP”. Default is TCP.
target_port
Optional ¶
target_port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: The value of
port
will be used.
The port number the service will redirect to.
ServiceIngressBackendOptions ¶
Options for setting up backends for ingress rules.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ServiceIngressBackendOptions(
port: typing.Union[int, float] = None
)
port
Optional ¶
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: if the service exposes a single port, this port will be used.
The port to use to access the service.
- This option will fail if the service does not expose any ports.
- If the service exposes multiple ports, this option must be specified.
- If the service exposes a single port, this option is optional and if specified, it must be the same port exposed by the service.
ServicePort ¶
Definition of a service port.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ServicePort(
name: str = None,
node_port: typing.Union[int, float] = None,
protocol: Protocol = None,
target_port: typing.Union[int, float] = None,
port: typing.Union[int, float]
)
name
Optional ¶
name: str
- Type:
str
The name of this port within the service.
This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. This maps to the ‘Name’ field in EndpointPort objects. Optional if only one ServicePort is defined on this service.
node_port
Optional ¶
node_port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: auto-allocate a port if the ServiceType of this Service requires one.
The port on each node on which this service is exposed when type=NodePort or LoadBalancer.
Usually assigned by the system. If specified, it will be allocated to the service if unused or else creation of the service will fail. Default is to auto-allocate a port if the ServiceType of this Service requires one.
https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
protocol
Optional ¶
protocol: Protocol
- Type:
cdk8s_plus_30.Protocol
- Default: Protocol.TCP
The IP protocol for this port.
Supports “TCP”, “UDP”, and “SCTP”. Default is TCP.
target_port
Optional ¶
target_port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: The value of
port
will be used.
The port number the service will redirect to.
port
Required ¶
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
The port number the service will bind to.
ServiceProps ¶
Properties for Service
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.ServiceProps(
metadata: ApiObjectMetadata = None,
cluster_i_p: str = None,
external_i_ps: typing.List[str] = None,
external_name: str = None,
load_balancer_source_ranges: typing.List[str] = None,
ports: typing.List[ServicePort] = None,
publish_not_ready_addresses: bool = None,
selector: IPodSelector = None,
type: ServiceType = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
cluster_i_p
Optional ¶
cluster_i_p: str
- Type:
str
- Default: Automatically assigned.
The IP address of the service and is usually assigned randomly by the master.
If an address is specified manually and is not in use by others, it will be allocated to the service; otherwise, creation of the service will fail. This field can not be changed through updates. Valid values are “None”, empty string (“”), or a valid IP address. “None” can be specified for headless services when proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName.
https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
external_i_ps
Optional ¶
external_i_ps: typing.List[str]
- Type: typing.List[
str
] - Default: No external IPs.
A list of IP addresses for which nodes in the cluster will also accept traffic for this service.
These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system.
external_name
Optional ¶
external_name: str
- Type:
str
- Default: No external name.
The externalName to be used when ServiceType.EXTERNAL_NAME is set.
load_balancer_source_ranges
Optional ¶
load_balancer_source_ranges: typing.List[str]
- Type: typing.List[
str
]
A list of CIDR IP addresses, if specified and supported by the platform, will restrict traffic through the cloud-provider load-balancer to the specified client IPs.
More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/
ports
Optional ¶
ports: typing.List[ServicePort]
- Type: typing.List[
cdk8s_plus_30.ServicePort
] - Default: either the selector ports, or none.
The ports this service binds to.
If the selector of the service is a managed pod / workload, its ports will are automatically extracted and used as the default value. Otherwise, no ports are bound.
publish_not_ready_addresses
Optional ¶
publish_not_ready_addresses: bool
- Type:
bool
- Default: false
The publishNotReadyAddresses indicates that any agent which deals with endpoints for this Service should disregard any indications of ready/not-ready.
More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#servicespec-v1-core
selector
Optional ¶
selector: IPodSelector
- Type:
cdk8s_plus_30.IPodSelector
- Default: unset, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify.
Which pods should the service select and route to.
You can pass one of the following:
- An instance of
Pod
or any workload resource (e.gDeployment
,StatefulSet
, …) - Pods selected by the
Pods.select
function. Note that in this case only labels can be specified.
type
Optional ¶
type: ServiceType
- Type:
cdk8s_plus_30.ServiceType
- Default: ServiceType.ClusterIP
Determines how the Service is exposed.
More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
SshAuthSecretProps ¶
Options for SshAuthSecret
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.SshAuthSecretProps(
metadata: ApiObjectMetadata = None,
immutable: bool = None,
ssh_private_key: str
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
immutable: bool
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
ssh_private_key
Required ¶
ssh_private_key: str
- Type:
str
The SSH private key to use.
StatefulSetProps ¶
Properties for initialization of StatefulSet
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.StatefulSetProps(
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None,
min_ready: Duration = None,
pod_management_policy: PodManagementPolicy = None,
replicas: typing.Union[int, float] = None,
service: Service = None,
strategy: StatefulSetUpdateStrategy = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
automount_service_account_token: bool
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
dns: PodDnsProps
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
docker_registry_auth: ISecret
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
host_aliases: typing.List[HostAlias]
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
host_network: bool
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
init_containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
isolate: bool
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
restart_policy: RestartPolicy
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
security_context: PodSecurityContextProps
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
service_account: IServiceAccount
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
termination_grace_period: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
volumes: typing.List[Volume]
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
pod_metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
select: bool
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
spread: bool
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
min_ready
Optional ¶
min_ready: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(0)
Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
Zero means the pod will be considered available as soon as it is ready.
This is an alpha field and requires enabling StatefulSetMinReadySeconds feature gate.
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#min-ready-seconds
pod_management_policy
Optional ¶
pod_management_policy: PodManagementPolicy
- Type:
cdk8s_plus_30.PodManagementPolicy
- Default: PodManagementPolicy.ORDERED_READY
Pod management policy to use for this statefulset.
replicas
Optional ¶
replicas: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 1
Number of desired pods.
service
Optional ¶
service: Service
- Type:
cdk8s_plus_30.Service
- Default: A new headless service will be created.
Service to associate with the statefulset.
strategy
Optional ¶
strategy: StatefulSetUpdateStrategy
- Type:
cdk8s_plus_30.StatefulSetUpdateStrategy
- Default: RollingUpdate with partition set to 0
Indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.
StatefulSetUpdateStrategyRollingUpdateOptions ¶
Options for StatefulSetUpdateStrategy.rollingUpdate
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.StatefulSetUpdateStrategyRollingUpdateOptions(
partition: typing.Union[int, float] = None
)
partition
Optional ¶
partition: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 0
If specified, all Pods with an ordinal that is greater than or equal to the partition will be updated when the StatefulSet’s .spec.template is updated. All Pods with an ordinal that is less than the partition will not be updated, and, even if they are deleted, they will be recreated at the previous version.
If the partition is greater than replicas, updates to the pod template will not be propagated to Pods. In most cases you will not need to use a partition, but they are useful if you want to stage an update, roll out a canary, or perform a phased roll out.
https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions
SubjectConfiguration ¶
Subject contains a reference to the object or user identities a role binding applies to.
This can either hold a direct API object reference, or a value for non-objects such as user and group names.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.SubjectConfiguration(
kind: str,
name: str,
api_group: str = None,
namespace: str = None
)
kind
Required ¶
kind: str
- Type:
str
Kind of object being referenced.
Values defined by this API group are “User”, “Group”, and “ServiceAccount”. If the Authorizer does not recognized the kind value, the Authorizer should report an error.
name
Required ¶
name: str
- Type:
str
Name of the object being referenced.
api_group
Optional ¶
api_group: str
- Type:
str
APIGroup holds the API group of the referenced subject.
Defaults to “” for ServiceAccount subjects. Defaults to “rbac.authorization.k8s.io” for User and Group subjects.
namespace
Optional ¶
namespace: str
- Type:
str
Namespace of the referenced object.
If the object kind is non-namespace, such as “User” or “Group”, and this value is not empty the Authorizer should report an error.
Sysctl ¶
Sysctl defines a kernel parameter to be set.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.Sysctl(
name: str,
value: str
)
name
Required ¶
name: str
- Type:
str
Name of a property to set.
value
Required ¶
value: str
- Type:
str
Value of a property to set.
TcpSocketProbeOptions ¶
Options for Probe.fromTcpSocket()
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.TcpSocketProbeOptions(
failure_threshold: typing.Union[int, float] = None,
initial_delay_seconds: Duration = None,
period_seconds: Duration = None,
success_threshold: typing.Union[int, float] = None,
timeout_seconds: Duration = None,
host: str = None,
port: typing.Union[int, float] = None
)
failure_threshold
Optional ¶
failure_threshold: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 3
Minimum consecutive failures for the probe to be considered failed after having succeeded.
Defaults to 3. Minimum value is 1.
initial_delay_seconds
Optional ¶
initial_delay_seconds: Duration
- Type:
cdk8s.Duration
- Default: immediate
Number of seconds after the container has started before liveness probes are initiated.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
period_seconds
Optional ¶
period_seconds: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(10) Minimum value is 1.
How often (in seconds) to perform the probe.
Default to 10 seconds. Minimum value is 1.
success_threshold
Optional ¶
success_threshold: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: 1 Must be 1 for liveness and startup. Minimum value is 1.
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.
timeout_seconds
Optional ¶
timeout_seconds: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(1)
Number of seconds after which the probe times out.
Defaults to 1 second. Minimum value is 1.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
host
Optional ¶
host: str
- Type:
str
- Default: defaults to the pod IP
The host name to connect to on the container.
port
Optional ¶
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: defaults to
container.port
.
The TCP port to connect to on the container.
TlsSecretProps ¶
Options for TlsSecret
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.TlsSecretProps(
metadata: ApiObjectMetadata = None,
immutable: bool = None,
tls_cert: str,
tls_key: str
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
immutable
Optional ¶
immutable: bool
- Type:
bool
- Default: false
If set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
If not set to true, the field can be modified at any time.
tls_cert
Required ¶
tls_cert: str
- Type:
str
The TLS cert.
tls_key
Required ¶
tls_key: str
- Type:
str
The TLS key.
VolumeMount ¶
Mount a volume from the pod to the container.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.VolumeMount(
propagation: MountPropagation = None,
read_only: bool = None,
sub_path: str = None,
sub_path_expr: str = None,
path: str,
volume: Volume
)
propagation
Optional ¶
propagation: MountPropagation
- Type:
cdk8s_plus_30.MountPropagation
- Default: MountPropagation.NONE
Determines how mounts are propagated from the host to container and the other way around.
When not set, MountPropagationNone is used.
Mount propagation allows for sharing volumes mounted by a Container to other Containers in the same Pod, or even to other Pods on the same node.
read_only
Optional ¶
read_only: bool
- Type:
bool
- Default: false
Mounted read-only if true, read-write otherwise (false or unspecified).
Defaults to false.
sub_path
Optional ¶
sub_path: str
- Type:
str
- Default: “” the volume’s root
Path within the volume from which the container’s volume should be mounted.).
sub_path_expr
Optional ¶
sub_path_expr: str
- Type:
str
- Default: “” volume’s root.
Expanded path within the volume from which the container’s volume should be mounted.
Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container’s environment. Defaults to “” (volume’s root).
subPathExpr
and subPath
are mutually exclusive.
path
Required ¶
path: str
- Type:
str
Path within the container at which the volume should be mounted.
Must not contain ‘:’.
volume
Required ¶
volume: Volume
- Type:
cdk8s_plus_30.Volume
The volume to mount.
WorkloadProps ¶
Properties for Workload
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.WorkloadProps(
metadata: ApiObjectMetadata = None,
automount_service_account_token: bool = None,
containers: typing.List[ContainerProps] = None,
dns: PodDnsProps = None,
docker_registry_auth: ISecret = None,
host_aliases: typing.List[HostAlias] = None,
host_network: bool = None,
init_containers: typing.List[ContainerProps] = None,
isolate: bool = None,
restart_policy: RestartPolicy = None,
security_context: PodSecurityContextProps = None,
service_account: IServiceAccount = None,
termination_grace_period: Duration = None,
volumes: typing.List[Volume] = None,
pod_metadata: ApiObjectMetadata = None,
select: bool = None,
spread: bool = None
)
metadata
Optional ¶
metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
Metadata that all persisted resources must have, which includes all objects users must create.
automount_service_account_token
Optional ¶
automount_service_account_token: bool
- Type:
bool
- Default: false
Indicates whether a service account token should be automatically mounted.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
containers
Optional ¶
containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No containers. Note that a pod spec must include at least one container.
List of containers belonging to the pod.
Containers cannot currently be added or removed. There must be at least one container in a Pod.
You can add additionnal containers using podSpec.addContainer()
dns
Optional ¶
dns: PodDnsProps
- Type:
cdk8s_plus_30.PodDnsProps
- Default: policy: DnsPolicy.CLUSTER_FIRST hostnameAsFQDN: false
DNS settings for the pod.
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
docker_registry_auth
Optional ¶
docker_registry_auth: ISecret
- Type:
cdk8s_plus_30.ISecret
- Default: No auth. Images are assumed to be publicly available.
A secret containing docker credentials for authenticating to a registry.
host_aliases
Optional ¶
host_aliases: typing.List[HostAlias]
- Type: typing.List[
cdk8s_plus_30.HostAlias
]
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod’s hosts file.
host_network
Optional ¶
host_network: bool
- Type:
bool
- Default: false
Host network for the pod.
init_containers
Optional ¶
init_containers: typing.List[ContainerProps]
- Type: typing.List[
cdk8s_plus_30.ContainerProps
] - Default: No init containers.
List of initialization containers belonging to the pod.
Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion.
Init containers cannot currently be added ,removed or updated.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
isolate
Optional ¶
isolate: bool
- Type:
bool
- Default: false
Isolates the pod.
This will prevent any ingress or egress connections to / from this pod.
You can however allow explicit connections post instantiation by using the .connections
property.
restart_policy
Optional ¶
restart_policy: RestartPolicy
- Type:
cdk8s_plus_30.RestartPolicy
- Default: RestartPolicy.ALWAYS
Restart policy for all containers within the pod.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
security_context
Optional ¶
security_context: PodSecurityContextProps
- Type:
cdk8s_plus_30.PodSecurityContextProps
- Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS ensureNonRoot: true
SecurityContext holds pod-level security attributes and common container settings.
service_account
Optional ¶
service_account: IServiceAccount
- Type:
cdk8s_plus_30.IServiceAccount
- Default: No service account.
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
termination_grace_period
Optional ¶
termination_grace_period: Duration
- Type:
cdk8s.Duration
- Default: Duration.seconds(30)
Grace period until the pod is terminated.
volumes
Optional ¶
volumes: typing.List[Volume]
- Type: typing.List[
cdk8s_plus_30.Volume
] - Default: No volumes.
List of volumes that can be mounted by containers belonging to the pod.
You can also add volumes later using podSpec.addVolume()
https://kubernetes.io/docs/concepts/storage/volumes
pod_metadata
Optional ¶
pod_metadata: ApiObjectMetadata
- Type:
cdk8s.ApiObjectMetadata
The pod metadata of this workload.
select
Optional ¶
select: bool
- Type:
bool
- Default: true
Automatically allocates a pod label selector for this workload and add it to the pod metadata.
This ensures this workload manages pods created by its pod template.
spread
Optional ¶
spread: bool
- Type:
bool
- Default: false
Automatically spread pods across hostname and zones.
https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints
WorkloadSchedulingSpreadOptions ¶
Options for WorkloadScheduling.spread
.
Initializer ¶
import cdk8s_plus_30
cdk8s_plus_30.WorkloadSchedulingSpreadOptions(
topology: Topology = None,
weight: typing.Union[int, float] = None
)
topology
Optional ¶
topology: Topology
- Type:
cdk8s_plus_30.Topology
- Default: Topology.HOSTNAME
Which topology to spread on.
weight
Optional ¶
weight: typing.Union[int, float]
- Type:
typing.Union[int, float]
- Default: no weight. spread is assumed to be required.
Indicates the spread is optional, with this weight score.
Classes ¶
ApiResource ¶
- Implements:
cdk8s_plus_30.IApiResource
,cdk8s_plus_30.IApiEndpoint
Represents information about an API resource type.
Methods ¶
as_api_resource
¶
def as_api_resource()
as_non_api_resource
¶
def as_non_api_resource()
Static Functions ¶
custom
¶
import cdk8s_plus_30
cdk8s_plus_30.ApiResource.custom(
api_group: str,
resource_type: str
)
api_group
Required ¶
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
- Type:
str
The name of the resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
Properties ¶
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of the resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
Constants ¶
API_SERVICES
¶
API resource information for APIService.
BINDINGS
¶
API resource information for Binding.
CERTIFICATE_SIGNING_REQUESTS
¶
API resource information for CertificateSigningRequest.
CLUSTER_ROLE_BINDINGS
¶
API resource information for ClusterRoleBinding.
CLUSTER_ROLES
¶
API resource information for ClusterRole.
COMPONENT_STATUSES
¶
API resource information for ComponentStatus.
CONFIG_MAPS
¶
API resource information for ConfigMap.
CONTROLLER_REVISIONS
¶
API resource information for ControllerRevision.
CRON_JOBS
¶
API resource information for CronJob.
CSI_DRIVERS
¶
API resource information for CSIDriver.
CSI_NODES
¶
API resource information for CSINode.
CSI_STORAGE_CAPACITIES
¶
API resource information for CSIStorageCapacity.
CUSTOM_RESOURCE_DEFINITIONS
¶
API resource information for CustomResourceDefinition.
DAEMON_SETS
¶
API resource information for DaemonSet.
DEPLOYMENTS
¶
API resource information for Deployment.
ENDPOINT_SLICES
¶
API resource information for EndpointSlice.
ENDPOINTS
¶
API resource information for Endpoints.
EVENTS
¶
API resource information for Event.
FLOW_SCHEMAS
¶
API resource information for FlowSchema.
HORIZONTAL_POD_AUTOSCALERS
¶
API resource information for HorizontalPodAutoscaler.
INGRESS_CLASSES
¶
API resource information for IngressClass.
INGRESSES
¶
API resource information for Ingress.
JOBS
¶
API resource information for Job.
LEASES
¶
API resource information for Lease.
LIMIT_RANGES
¶
API resource information for LimitRange.
LOCAL_SUBJECT_ACCESS_REVIEWS
¶
API resource information for LocalSubjectAccessReview.
MUTATING_WEBHOOK_CONFIGURATIONS
¶
API resource information for MutatingWebhookConfiguration.
NAMESPACES
¶
API resource information for Namespace.
NETWORK_POLICIES
¶
API resource information for NetworkPolicy.
NODES
¶
API resource information for Node.
PERSISTENT_VOLUME_CLAIMS
¶
API resource information for PersistentVolumeClaim.
PERSISTENT_VOLUMES
¶
API resource information for PersistentVolume.
POD_DISRUPTION_BUDGETS
¶
API resource information for PodDisruptionBudget.
POD_TEMPLATES
¶
API resource information for PodTemplate.
PODS
¶
API resource information for Pod.
PRIORITY_CLASSES
¶
API resource information for PriorityClass.
PRIORITY_LEVEL_CONFIGURATIONS
¶
API resource information for PriorityLevelConfiguration.
REPLICA_SETS
¶
API resource information for ReplicaSet.
REPLICATION_CONTROLLERS
¶
API resource information for ReplicationController.
RESOURCE_QUOTAS
¶
API resource information for ResourceQuota.
ROLE_BINDINGS
¶
API resource information for RoleBinding.
ROLES
¶
API resource information for Role.
RUNTIME_CLASSES
¶
API resource information for RuntimeClass.
SECRETS
¶
API resource information for Secret.
SELF_SUBJECT_ACCESS_REVIEWS
¶
API resource information for SelfSubjectAccessReview.
SELF_SUBJECT_RULES_REVIEWS
¶
API resource information for SelfSubjectRulesReview.
SERVICE_ACCOUNTS
¶
API resource information for ServiceAccount.
SERVICES
¶
API resource information for Service.
STATEFUL_SETS
¶
API resource information for StatefulSet.
STORAGE_CLASSES
¶
API resource information for StorageClass.
SUBJECT_ACCESS_REVIEWS
¶
API resource information for SubjectAccessReview.
TOKEN_REVIEWS
¶
API resource information for TokenReview.
VALIDATING_WEBHOOK_CONFIGURATIONS
¶
API resource information for ValidatingWebhookConfiguration.
VOLUME_ATTACHMENTS
¶
API resource information for VolumeAttachment.
Container ¶
A single application container that you want to run within a pod.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Container(
args: typing.List[str] = None,
command: typing.List[str] = None,
env_from: typing.List[EnvFrom] = None,
env_variables: typing.Mapping[EnvValue] = None,
image_pull_policy: ImagePullPolicy = None,
lifecycle: ContainerLifecycle = None,
liveness: Probe = None,
name: str = None,
port: typing.Union[int, float] = None,
port_number: typing.Union[int, float] = None,
ports: typing.List[ContainerPort] = None,
readiness: Probe = None,
resources: ContainerResources = None,
restart_policy: ContainerRestartPolicy = None,
security_context: ContainerSecurityContextProps = None,
startup: Probe = None,
volume_mounts: typing.List[VolumeMount] = None,
working_dir: str = None,
image: str
)
args
Optional ¶
- Type: typing.List[
str
] - Default: []
Arguments to the entrypoint. The docker image’s CMD is used if command
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.
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
command
Optional ¶
- Type: typing.List[
str
] - Default: The docker image’s ENTRYPOINT.
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
env_from
Optional ¶
- Type: typing.List[
cdk8s_plus_30.EnvFrom
] - Default: No sources.
List of sources to populate environment variables in the container.
When a key exists in multiple sources, the value associated with
the last source will take precedence. Values defined by the envVariables
property
with a duplicate key will take precedence.
env_variables
Optional ¶
- Type: typing.Mapping[
cdk8s_plus_30.EnvValue
] - Default: No environment variables.
Environment variables to set in the container.
image_pull_policy
Optional ¶
- Type:
cdk8s_plus_30.ImagePullPolicy
- Default: ImagePullPolicy.ALWAYS
Image pull policy for this container.
lifecycle
Optional ¶
Describes actions that the management system should take in response to container lifecycle events.
liveness
Optional ¶
- Type:
cdk8s_plus_30.Probe
- Default: no liveness probe is defined
Periodic probe of container liveness.
Container will be restarted if the probe fails.
name
Optional ¶
- Type:
str
- Default: ‘main’
Name of the container specified as a DNS_LABEL.
Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.
~~port
~~Optional ¶
-
Deprecated: - use
portNumber
. -
Type:
typing.Union[int, float]
port_number
Optional ¶
- Type:
typing.Union[int, float]
- Default: Only the ports mentiond in the
ports
property are exposed.
Number of port to expose on the pod’s IP address.
This must be a valid port number, 0 < x < 65536.
This is a convinience property if all you need a single TCP numbered port.
In case more advanced configuartion is required, use the ports
property.
This port is added to the list of ports mentioned in the ports
property.
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.ContainerPort
] - Default: Only the port mentioned in the
portNumber
property is exposed.
List of ports to expose from this container.
readiness
Optional ¶
- Type:
cdk8s_plus_30.Probe
- Default: no readiness probe is defined
Determines when the container is ready to serve traffic.
resources
Optional ¶
- Type:
cdk8s_plus_30.ContainerResources
- Default: cpu: request: 1000 millis limit: 1500 millis memory: request: 512 mebibytes limit: 2048 mebibytes
Compute resources (CPU and memory requests and limits) required by the container.
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
restart_policy
Optional ¶
- Type:
cdk8s_plus_30.ContainerRestartPolicy
- Default: no restart policy is defined and the pod restart policy is applied
Kubelet will start init containers with restartPolicy=Always in the order with other init containers, but instead of waiting for its completion, it will wait for the container startup completion Currently, only accepted value is Always.
https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
security_context
Optional ¶
- Type:
cdk8s_plus_30.ContainerSecurityContextProps
- Default: ensureNonRoot: true privileged: false readOnlyRootFilesystem: true allowPrivilegeEscalation: false user: 25000 group: 26000
SecurityContext defines the security options the container should be run with.
If set, the fields override equivalent fields of the pod’s security context.
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
startup
Optional ¶
- Type:
cdk8s_plus_30.Probe
- Default: If a port is provided, then knocks on that port to determine when the container is ready for readiness and liveness probe checks. Otherwise, no startup probe is defined.
StartupProbe indicates that the Pod has successfully initialized.
If specified, no other probes are executed until this completes successfully
volume_mounts
Optional ¶
- Type: typing.List[
cdk8s_plus_30.VolumeMount
]
Pod volumes to mount into the container’s filesystem.
Cannot be updated.
working_dir
Optional ¶
- Type:
str
- Default: The container runtime’s default.
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.
image
Required ¶
- Type:
str
Docker image name.
Methods ¶
add_port
¶
def add_port(
number: typing.Union[int, float],
host_ip: str = None,
host_port: typing.Union[int, float] = None,
name: str = None,
protocol: Protocol = None
)
number
Required ¶
- Type:
typing.Union[int, float]
Number of port to expose on the pod’s IP address.
This must be a valid port number, 0 < x < 65536.
host_ip
Optional ¶
- Type:
str
- Default: 127.0.0.1.
What host IP to bind the external port to.
host_port
Optional ¶
- Type:
typing.Union[int, float]
- Default: auto generated by kubernetes and might change on restarts.
Number of port to expose on the host.
If specified, this must be a valid port number, 0 < x < 65536. Most containers do not need this.
name
Optional ¶
- Type:
str
- Default: port is not named.
If specified, this must be an IANA_SVC_NAME and unique within the pod.
Each named port in a pod must have a unique name. Name for the port that can be referred to by services.
protocol
Optional ¶
- Type:
cdk8s_plus_30.Protocol
- Default: Protocol.TCP
Protocol for port.
Must be UDP, TCP, or SCTP. Defaults to “TCP”.
mount
¶
def mount(
path: str,
storage: IStorage,
propagation: MountPropagation = None,
read_only: bool = None,
sub_path: str = None,
sub_path_expr: str = None
)
path
Required ¶
- Type:
str
The desired path in the container.
storage
Required ¶
- Type:
cdk8s_plus_30.IStorage
The storage to mount.
propagation
Optional ¶
- Type:
cdk8s_plus_30.MountPropagation
- Default: MountPropagation.NONE
Determines how mounts are propagated from the host to container and the other way around.
When not set, MountPropagationNone is used.
Mount propagation allows for sharing volumes mounted by a Container to other Containers in the same Pod, or even to other Pods on the same node.
read_only
Optional ¶
- Type:
bool
- Default: false
Mounted read-only if true, read-write otherwise (false or unspecified).
Defaults to false.
sub_path
Optional ¶
- Type:
str
- Default: “” the volume’s root
Path within the volume from which the container’s volume should be mounted.).
sub_path_expr
Optional ¶
- Type:
str
- Default: “” volume’s root.
Expanded path within the volume from which the container’s volume should be mounted.
Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container’s environment. Defaults to “” (volume’s root).
subPathExpr
and subPath
are mutually exclusive.
Properties ¶
env
Required ¶
env: Env
- Type:
cdk8s_plus_30.Env
The environment of the container.
image
Required ¶
image: str
- Type:
str
The container image.
image_pull_policy
Required ¶
image_pull_policy: ImagePullPolicy
Image pull policy for this container.
mounts
Required ¶
mounts: typing.List[VolumeMount]
- Type: typing.List[
cdk8s_plus_30.VolumeMount
]
Volume mounts configured for this container.
name
Required ¶
name: str
- Type:
str
The name of the container.
ports
Required ¶
ports: typing.List[ContainerPort]
- Type: typing.List[
cdk8s_plus_30.ContainerPort
]
Ports exposed by this containers.
Returns a copy, use addPort
to modify.
security_context
Required ¶
security_context: ContainerSecurityContext
The security context of the container.
args
Optional ¶
args: typing.List[str]
- Type: typing.List[
str
]
Arguments to the entrypoint.
command
Optional ¶
command: typing.List[str]
- Type: typing.List[
str
]
Entrypoint array (the command to execute when the container starts).
~~port
~~Optional ¶
- Deprecated: - use
portNumber
.
port: typing.Union[int, float]
- Type:
typing.Union[int, float]
port_number
Optional ¶
port_number: typing.Union[int, float]
- Type:
typing.Union[int, float]
The port number that was configured for this container.
If undefined, either the container doesn’t expose a port, or its
port configuration is stored in the ports
field.
resources
Optional ¶
resources: ContainerResources
Compute resources (CPU and memory requests and limits) required by the container.
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
restart_policy
Optional ¶
restart_policy: ContainerRestartPolicy
The restart policy of the container.
working_dir
Optional ¶
working_dir: str
- Type:
str
The working directory inside the container.
ContainerSecurityContext ¶
Container security attributes and settings.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.ContainerSecurityContext(
allow_privilege_escalation: bool = None,
capabilities: ContainerSecutiryContextCapabilities = None,
ensure_non_root: bool = None,
group: typing.Union[int, float] = None,
privileged: bool = None,
read_only_root_filesystem: bool = None,
seccomp_profile: SeccompProfile = None,
user: typing.Union[int, float] = None
)
allow_privilege_escalation
Optional ¶
- Type:
bool
- Default: false
Whether a process can gain more privileges than its parent process.
capabilities
Optional ¶
- Type:
cdk8s_plus_30.ContainerSecutiryContextCapabilities
- Default: none
POSIX capabilities for running containers.
ensure_non_root
Optional ¶
- Type:
bool
- Default: true
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.
group
Optional ¶
- Type:
typing.Union[int, float]
- Default: 26000. An arbitrary number bigger than 9999 is selected here. This is so that the container is blocked to access host files even if somehow it manages to get access to host file system.
The GID to run the entrypoint of the container process.
privileged
Optional ¶
- Type:
bool
- Default: false
Run container in privileged mode.
Processes in privileged containers are essentially equivalent to root on the host.
read_only_root_filesystem
Optional ¶
- Type:
bool
- Default: true
Whether this container has a read-only root filesystem.
seccomp_profile
Optional ¶
- Type:
cdk8s_plus_30.SeccompProfile
- Default: none
Container’s seccomp profile settings.
Only one profile source may be set
user
Optional ¶
- Type:
typing.Union[int, float]
- Default: 25000. An arbitrary number bigger than 9999 is selected here. This is so that the container is blocked to access host files even if somehow it manages to get access to host file system.
The UID to run the entrypoint of the container process.
Properties ¶
ensure_non_root
Required ¶
ensure_non_root: bool
- Type:
bool
privileged
Required ¶
privileged: bool
- Type:
bool
read_only_root_filesystem
Required ¶
read_only_root_filesystem: bool
- Type:
bool
allow_privilege_escalation
Optional ¶
allow_privilege_escalation: bool
- Type:
bool
capabilities
Optional ¶
capabilities: ContainerSecutiryContextCapabilities
group
Optional ¶
group: typing.Union[int, float]
- Type:
typing.Union[int, float]
seccomp_profile
Optional ¶
seccomp_profile: SeccompProfile
user
Optional ¶
user: typing.Union[int, float]
- Type:
typing.Union[int, float]
Cpu ¶
Represents the amount of CPU.
The amount can be passed as millis or units.
Static Functions ¶
millis
¶
import cdk8s_plus_30
cdk8s_plus_30.Cpu.millis(
amount: typing.Union[int, float]
)
amount
Required ¶
- Type:
typing.Union[int, float]
units
¶
import cdk8s_plus_30
cdk8s_plus_30.Cpu.units(
amount: typing.Union[int, float]
)
amount
Required ¶
- Type:
typing.Union[int, float]
Properties ¶
amount
Required ¶
amount: str
- Type:
str
DeploymentStrategy ¶
Deployment strategies.
Static Functions ¶
recreate
¶
import cdk8s_plus_30
cdk8s_plus_30.DeploymentStrategy.recreate()
rolling_update
¶
import cdk8s_plus_30
cdk8s_plus_30.DeploymentStrategy.rolling_update(
max_surge: PercentOrAbsolute = None,
max_unavailable: PercentOrAbsolute = None
)
max_surge
Optional ¶
- Type:
cdk8s_plus_30.PercentOrAbsolute
- Default: ‘25%’
The maximum number of pods that can be scheduled above the desired number of pods.
Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
Absolute number is calculated from percentage by rounding up.
This can not be 0 if maxUnavailable
is 0.
Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.
max_unavailable
Optional ¶
- Type:
cdk8s_plus_30.PercentOrAbsolute
- Default: ‘25%’
The maximum number of pods that can be unavailable during the update.
Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
Absolute number is calculated from percentage by rounding down.
This can not be 0 if maxSurge
is 0.
Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.
Env ¶
Container environment variables.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Env(
sources: typing.List[EnvFrom],
variables: typing.Mapping[EnvValue]
)
sources
Required ¶
- Type: typing.List[
cdk8s_plus_30.EnvFrom
]
variables
Required ¶
- Type: typing.Mapping[
cdk8s_plus_30.EnvValue
]
Methods ¶
add_variable
¶
def add_variable(
name: str,
value: EnvValue
)
name
Required ¶
- Type:
str
value
Required ¶
- Type:
cdk8s_plus_30.EnvValue
copy_from
¶
def copy_from(
from: EnvFrom
)
from
Required ¶
- Type:
cdk8s_plus_30.EnvFrom
Static Functions ¶
from_config_map
¶
import cdk8s_plus_30
cdk8s_plus_30.Env.from_config_map(
config_map: IConfigMap,
prefix: str = None
)
config_map
Required ¶
- Type:
cdk8s_plus_30.IConfigMap
prefix
Optional ¶
- Type:
str
from_secret
¶
import cdk8s_plus_30
cdk8s_plus_30.Env.from_secret(
secr: ISecret
)
secr
Required ¶
- Type:
cdk8s_plus_30.ISecret
Properties ¶
sources
Required ¶
sources: typing.List[EnvFrom]
- Type: typing.List[
cdk8s_plus_30.EnvFrom
]
The list of sources used to populate the container environment, in addition to the variables
.
Returns a copy. To add a source use container.env.copyFrom()
.
variables
Required ¶
variables: typing.Mapping[EnvValue]
- Type: typing.Mapping[
cdk8s_plus_30.EnvValue
]
The environment variables for this container.
Returns a copy. To add environment variables use container.env.addVariable()
.
EnvFrom ¶
A collection of env variables defined in other resources.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.EnvFrom(
config_map: IConfigMap = None,
prefix: str = None,
sec: ISecret = None
)
config_map
Optional ¶
- Type:
cdk8s_plus_30.IConfigMap
prefix
Optional ¶
- Type:
str
sec
Optional ¶
- Type:
cdk8s_plus_30.ISecret
EnvValue ¶
Utility class for creating reading env values from various sources.
Static Functions ¶
from_config_map
¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValue.from_config_map(
config_map: IConfigMap,
key: str,
optional: bool = None
)
config_map
Required ¶
- Type:
cdk8s_plus_30.IConfigMap
The config map.
key
Required ¶
- Type:
str
The key to extract the value from.
optional
Optional ¶
- Type:
bool
- Default: false
Specify whether the ConfigMap or its key must be defined.
from_field_ref
¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValue.from_field_ref(
field_path: EnvFieldPaths,
api_version: str = None,
key: str = None
)
field_path
Required ¶
: The field reference.
api_version
Optional ¶
- Type:
str
Version of the schema the FieldPath is written in terms of.
key
Optional ¶
- Type:
str
The key to select the pod label or annotation.
from_process
¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValue.from_process(
key: str,
required: bool = None
)
key
Required ¶
- Type:
str
The key to read.
required
Optional ¶
- Type:
bool
- Default: false
Specify whether the key must exist in the environment.
If this is set to true, and the key does not exist, an error will thrown.
from_resource
¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValue.from_resource(
resource: ResourceFieldPaths,
container: Container = None,
divisor: str = None
)
resource
Required ¶
: Resource to select the value from.
container
Optional ¶
- Type:
cdk8s_plus_30.Container
The container to select the value from.
divisor
Optional ¶
- Type:
str
The output format of the exposed resource.
from_secret_value
¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValue.from_secret_value(
key: str,
secret: ISecret,
optional: bool = None
)
key
Required ¶
- Type:
str
The JSON key.
secret
Required ¶
- Type:
cdk8s_plus_30.ISecret
The secret.
optional
Optional ¶
- Type:
bool
- Default: false
Specify whether the Secret or its key must be defined.
from_value
¶
import cdk8s_plus_30
cdk8s_plus_30.EnvValue.from_value(
value: str
)
value
Required ¶
- Type:
str
The value.
Properties ¶
value
Optional ¶
value: typing.Any
- Type:
typing.Any
value_from
Optional ¶
value_from: typing.Any
- Type:
typing.Any
Handler ¶
Defines a specific action that should be taken.
Static Functions ¶
from_command
¶
import cdk8s_plus_30
cdk8s_plus_30.Handler.from_command(
command: typing.List[str]
)
command
Required ¶
- Type: typing.List[
str
]
The command to execute.
from_http_get
¶
import cdk8s_plus_30
cdk8s_plus_30.Handler.from_http_get(
path: str,
port: typing.Union[int, float] = None
)
path
Required ¶
- Type:
str
The URL path to hit.
port
Optional ¶
- Type:
typing.Union[int, float]
- Default: defaults to
container.port
.
The TCP port to use when sending the GET request.
from_tcp_socket
¶
import cdk8s_plus_30
cdk8s_plus_30.Handler.from_tcp_socket(
host: str = None,
port: typing.Union[int, float] = None
)
host
Optional ¶
- Type:
str
- Default: defaults to the pod IP
The host name to connect to on the container.
port
Optional ¶
- Type:
typing.Union[int, float]
- Default: defaults to
container.port
.
The TCP port to connect to on the container.
IngressBackend ¶
The backend for an ingress path.
Static Functions ¶
from_resource
¶
import cdk8s_plus_30
cdk8s_plus_30.IngressBackend.from_resource(
resource: IResource
)
resource
Required ¶
- Type:
cdk8s_plus_30.IResource
from_service
¶
import cdk8s_plus_30
cdk8s_plus_30.IngressBackend.from_service(
serv: Service,
port: typing.Union[int, float] = None
)
serv
Required ¶
- Type:
cdk8s_plus_30.Service
The service object.
port
Optional ¶
- Type:
typing.Union[int, float]
- Default: if the service exposes a single port, this port will be used.
The port to use to access the service.
- This option will fail if the service does not expose any ports.
- If the service exposes multiple ports, this option must be specified.
- If the service exposes a single port, this option is optional and if specified, it must be the same port exposed by the service.
LabeledNode ¶
A node that is matched by label selectors.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.LabeledNode(
label_selector: typing.List[NodeLabelQuery]
)
label_selector
Required ¶
- Type: typing.List[
cdk8s_plus_30.NodeLabelQuery
]
Properties ¶
label_selector
Required ¶
label_selector: typing.List[NodeLabelQuery]
- Type: typing.List[
cdk8s_plus_30.NodeLabelQuery
]
LabelExpression ¶
Represents a query that can be performed against resources with labels.
Static Functions ¶
does_not_exist
¶
import cdk8s_plus_30
cdk8s_plus_30.LabelExpression.does_not_exist(
key: str
)
key
Required ¶
- Type:
str
exists
¶
import cdk8s_plus_30
cdk8s_plus_30.LabelExpression.exists(
key: str
)
key
Required ¶
- Type:
str
in
¶
import cdk8s_plus_30
cdk8s_plus_30.LabelExpression.in(
key: str,
values: typing.List[str]
)
key
Required ¶
- Type:
str
values
Required ¶
- Type: typing.List[
str
]
not_in
¶
import cdk8s_plus_30
cdk8s_plus_30.LabelExpression.not_in(
key: str,
values: typing.List[str]
)
key
Required ¶
- Type:
str
values
Required ¶
- Type: typing.List[
str
]
Properties ¶
key
Required ¶
key: str
- Type:
str
operator
Required ¶
operator: str
- Type:
str
values
Optional ¶
values: typing.List[str]
- Type: typing.List[
str
]
LabelSelector ¶
Match a resource by labels.
Methods ¶
is_empty
¶
def is_empty()
Static Functions ¶
of
¶
import cdk8s_plus_30
cdk8s_plus_30.LabelSelector.of(
expressions: typing.List[LabelExpression] = None,
labels: typing.Mapping[str] = None
)
expressions
Optional ¶
- Type: typing.List[
cdk8s_plus_30.LabelExpression
]
Expression based label matchers.
labels
Optional ¶
- Type: typing.Mapping[
str
]
Strict label matchers.
Metric ¶
A metric condition that HorizontalPodAutoscaler’s scale on.
Static Functions ¶
container_cpu
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.container_cpu(
container: Container,
target: MetricTarget
)
container
Required ¶
- Type:
cdk8s_plus_30.Container
Container where the metric can be found.
target
Required ¶
Target metric value that will trigger scaling.
container_ephemeral_storage
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.container_ephemeral_storage(
container: Container,
target: MetricTarget
)
container
Required ¶
- Type:
cdk8s_plus_30.Container
Container where the metric can be found.
target
Required ¶
Target metric value that will trigger scaling.
container_memory
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.container_memory(
container: Container,
target: MetricTarget
)
container
Required ¶
- Type:
cdk8s_plus_30.Container
Container where the metric can be found.
target
Required ¶
Target metric value that will trigger scaling.
container_storage
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.container_storage(
container: Container,
target: MetricTarget
)
container
Required ¶
- Type:
cdk8s_plus_30.Container
Container where the metric can be found.
target
Required ¶
Target metric value that will trigger scaling.
external
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.external(
name: str,
target: MetricTarget,
label_selector: LabelSelector = None
)
name
Required ¶
- Type:
str
The name of the metric to scale on.
target
Required ¶
The target metric value that will trigger scaling.
label_selector
Optional ¶
- Type:
cdk8s_plus_30.LabelSelector
- Default: Just the metric ‘name’ will be used to gather metrics.
A selector to find a metric by label.
When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping.
object
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.object(
name: str,
target: MetricTarget,
label_selector: LabelSelector = None,
object: IResource
)
name
Required ¶
- Type:
str
The name of the metric to scale on.
target
Required ¶
The target metric value that will trigger scaling.
label_selector
Optional ¶
- Type:
cdk8s_plus_30.LabelSelector
- Default: Just the metric ‘name’ will be used to gather metrics.
A selector to find a metric by label.
When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping.
object
Required ¶
- Type:
cdk8s_plus_30.IResource
Resource where the metric can be found.
pods
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.pods(
name: str,
target: MetricTarget,
label_selector: LabelSelector = None
)
name
Required ¶
- Type:
str
The name of the metric to scale on.
target
Required ¶
The target metric value that will trigger scaling.
label_selector
Optional ¶
- Type:
cdk8s_plus_30.LabelSelector
- Default: Just the metric ‘name’ will be used to gather metrics.
A selector to find a metric by label.
When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping.
resource_cpu
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.resource_cpu(
target: MetricTarget
)
target
Required ¶
resource_ephemeral_storage
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.resource_ephemeral_storage(
target: MetricTarget
)
target
Required ¶
resource_memory
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.resource_memory(
target: MetricTarget
)
target
Required ¶
resource_storage
¶
import cdk8s_plus_30
cdk8s_plus_30.Metric.resource_storage(
target: MetricTarget
)
target
Required ¶
Properties ¶
type
Required ¶
type: str
- Type:
str
MetricTarget ¶
A metric condition that will trigger scaling behavior when satisfied.
Static Functions ¶
average_utilization
¶
import cdk8s_plus_30
cdk8s_plus_30.MetricTarget.average_utilization(
average_utilization: typing.Union[int, float]
)
average_utilization
Required ¶
- Type:
typing.Union[int, float]
The percentage of the utilization metric.
e.g. 50
for 50%.
average_value
¶
import cdk8s_plus_30
cdk8s_plus_30.MetricTarget.average_value(
average_value: typing.Union[int, float]
)
average_value
Required ¶
- Type:
typing.Union[int, float]
The average metric value.
value
¶
import cdk8s_plus_30
cdk8s_plus_30.MetricTarget.value(
value: typing.Union[int, float]
)
value
Required ¶
- Type:
typing.Union[int, float]
The target value.
NamedNode ¶
A node that is matched by its name.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.NamedNode(
name: str
)
name
Required ¶
- Type:
str
Properties ¶
name
Required ¶
name: str
- Type:
str
NetworkPolicyPort ¶
Describes a port to allow traffic on.
Static Functions ¶
all_tcp
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyPort.all_tcp()
all_udp
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyPort.all_udp()
of
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyPort.of(
end_port: typing.Union[int, float] = None,
port: typing.Union[int, float] = None,
protocol: NetworkProtocol = None
)
end_port
Optional ¶
- Type:
typing.Union[int, float]
- Default: not a port range.
End port (relative to port
).
Only applies if port
is defined.
Use this to specify a port range, rather that a specific one.
port
Optional ¶
- Type:
typing.Union[int, float]
- Default: all ports are allowed.
Specific port number.
protocol
Optional ¶
- Type:
cdk8s_plus_30.NetworkProtocol
- Default: NetworkProtocol.TCP
Protocol.
tcp
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyPort.tcp(
port: typing.Union[int, float]
)
port
Required ¶
- Type:
typing.Union[int, float]
tcp_range
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyPort.tcp_range(
start_port: typing.Union[int, float],
end_port: typing.Union[int, float]
)
start_port
Required ¶
- Type:
typing.Union[int, float]
end_port
Required ¶
- Type:
typing.Union[int, float]
udp
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyPort.udp(
port: typing.Union[int, float]
)
port
Required ¶
- Type:
typing.Union[int, float]
udp_range
¶
import cdk8s_plus_30
cdk8s_plus_30.NetworkPolicyPort.udp_range(
start_port: typing.Union[int, float],
end_port: typing.Union[int, float]
)
start_port
Required ¶
- Type:
typing.Union[int, float]
end_port
Required ¶
- Type:
typing.Union[int, float]
Node ¶
Represents a node in the cluster.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.Node()
Static Functions ¶
labeled
¶
import cdk8s_plus_30
cdk8s_plus_30.Node.labeled(
label_selector: NodeLabelQuery
)
label_selector
Required ¶
named
¶
import cdk8s_plus_30
cdk8s_plus_30.Node.named(
node_name: str
)
node_name
Required ¶
- Type:
str
tainted
¶
import cdk8s_plus_30
cdk8s_plus_30.Node.tainted(
taint_selector: NodeTaintQuery
)
taint_selector
Required ¶
NodeLabelQuery ¶
Represents a query that can be performed against nodes with labels.
Static Functions ¶
does_not_exist
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeLabelQuery.does_not_exist(
key: str
)
key
Required ¶
- Type:
str
exists
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeLabelQuery.exists(
key: str
)
key
Required ¶
- Type:
str
gt
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeLabelQuery.gt(
key: str,
values: typing.List[str]
)
key
Required ¶
- Type:
str
values
Required ¶
- Type: typing.List[
str
]
in
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeLabelQuery.in(
key: str,
values: typing.List[str]
)
key
Required ¶
- Type:
str
values
Required ¶
- Type: typing.List[
str
]
is
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeLabelQuery.is(
key: str,
value: str
)
key
Required ¶
- Type:
str
value
Required ¶
- Type:
str
lt
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeLabelQuery.lt(
key: str,
values: typing.List[str]
)
key
Required ¶
- Type:
str
values
Required ¶
- Type: typing.List[
str
]
not_in
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeLabelQuery.not_in(
key: str,
values: typing.List[str]
)
key
Required ¶
- Type:
str
values
Required ¶
- Type: typing.List[
str
]
NodeTaintQuery ¶
Taint queries that can be perfomed against nodes.
Static Functions ¶
any
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeTaintQuery.any()
exists
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeTaintQuery.exists(
key: str,
effect: TaintEffect = None,
evict_after: Duration = None
)
key
Required ¶
- Type:
str
effect
Optional ¶
- Type:
cdk8s_plus_30.TaintEffect
- Default: all effects are matched.
The taint effect to match.
evict_after
Optional ¶
- Type:
cdk8s.Duration
- Default: bound forever.
How much time should a pod that tolerates the NO_EXECUTE
effect be bound to the node.
Only applies for the NO_EXECUTE
effect.
is
¶
import cdk8s_plus_30
cdk8s_plus_30.NodeTaintQuery.is(
key: str,
value: str,
effect: TaintEffect = None,
evict_after: Duration = None
)
key
Required ¶
- Type:
str
value
Required ¶
- Type:
str
effect
Optional ¶
- Type:
cdk8s_plus_30.TaintEffect
- Default: all effects are matched.
The taint effect to match.
evict_after
Optional ¶
- Type:
cdk8s.Duration
- Default: bound forever.
How much time should a pod that tolerates the NO_EXECUTE
effect be bound to the node.
Only applies for the NO_EXECUTE
effect.
NonApiResource ¶
- Implements:
cdk8s_plus_30.IApiEndpoint
Factory for creating non api resources.
Methods ¶
as_api_resource
¶
def as_api_resource()
as_non_api_resource
¶
def as_non_api_resource()
Static Functions ¶
of
¶
import cdk8s_plus_30
cdk8s_plus_30.NonApiResource.of(
url: str
)
url
Required ¶
- Type:
str
PercentOrAbsolute ¶
Union like class repsenting either a ration in percents or an absolute number.
Methods ¶
is_zero
¶
def is_zero()
Static Functions ¶
absolute
¶
import cdk8s_plus_30
cdk8s_plus_30.PercentOrAbsolute.absolute(
num: typing.Union[int, float]
)
num
Required ¶
- Type:
typing.Union[int, float]
percent
¶
import cdk8s_plus_30
cdk8s_plus_30.PercentOrAbsolute.percent(
percent: typing.Union[int, float]
)
percent
Required ¶
- Type:
typing.Union[int, float]
Properties ¶
value
Required ¶
value: typing.Any
- Type:
typing.Any
PodConnections ¶
Controls network isolation rules for inter-pod communication.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.PodConnections(
instance: AbstractPod
)
instance
Required ¶
Methods ¶
allow_from
¶
def allow_from(
peer: INetworkPolicyPeer,
isolation: PodConnectionsIsolation = None,
ports: typing.List[NetworkPolicyPort] = None
)
peer
Required ¶
isolation
Optional ¶
- Type:
cdk8s_plus_30.PodConnectionsIsolation
- Default: unset, isolates both the pod and the peer.
Which isolation should be applied to establish the connection.
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.NetworkPolicyPort
] - Default: The pod ports.
Ports to allow incoming traffic to.
allow_to
¶
def allow_to(
peer: INetworkPolicyPeer,
isolation: PodConnectionsIsolation = None,
ports: typing.List[NetworkPolicyPort] = None
)
peer
Required ¶
isolation
Optional ¶
- Type:
cdk8s_plus_30.PodConnectionsIsolation
- Default: unset, isolates both the pod and the peer.
Which isolation should be applied to establish the connection.
ports
Optional ¶
- Type: typing.List[
cdk8s_plus_30.NetworkPolicyPort
] - Default: If the peer is a managed pod, take its ports. Otherwise, all ports are allowed.
Ports to allow outgoing traffic to.
isolate
¶
def isolate()
PodDns ¶
Holds dns settings of the pod.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.PodDns(
hostname: str = None,
hostname_as_fqd_n: bool = None,
nameservers: typing.List[str] = None,
options: typing.List[DnsOption] = None,
policy: DnsPolicy = None,
searches: typing.List[str] = None,
subdomain: str = None
)
hostname
Optional ¶
- Type:
str
- Default: Set to a system-defined value.
Specifies the hostname of the Pod.
hostname_as_fqd_n
Optional ¶
- Type:
bool
- Default: false
If true the pod’s hostname will be configured as the pod’s FQDN, rather than the leaf name (the default).
In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters to FQDN. If a pod does not have FQDN, this has no effect.
nameservers
Optional ¶
- Type: typing.List[
str
]
A list of IP addresses that will be used as DNS servers for the Pod.
There can be at most 3 IP addresses specified. When the policy is set to “NONE”, the list must contain at least one IP address, otherwise this property is optional. The servers listed will be combined to the base nameservers generated from the specified DNS policy with duplicate addresses removed.
options
Optional ¶
- Type: typing.List[
cdk8s_plus_30.DnsOption
]
List of objects where each object may have a name property (required) and a value property (optional).
The contents in this property will be merged to the options generated from the specified DNS policy. Duplicate entries are removed.
policy
Optional ¶
- Type:
cdk8s_plus_30.DnsPolicy
- Default: DnsPolicy.CLUSTER_FIRST
Set DNS policy for the pod.
If policy is set to None
, other configuration must be supplied.
searches
Optional ¶
- Type: typing.List[
str
]
A list of DNS search domains for hostname lookup in the Pod.
When specified, the provided list will be merged into the base search domain names generated from the chosen DNS policy. Duplicate domain names are removed.
Kubernetes allows for at most 6 search domains.
subdomain
Optional ¶
- Type:
str
- Default: No subdomain.
If specified, the fully qualified Pod hostname will be “
Methods ¶
add_nameserver
¶
def add_nameserver(
nameservers: str
)
nameservers
Required ¶
- Type:
str
add_option
¶
def add_option(
name: str,
value: str = None
)
name
Required ¶
- Type:
str
Option name.
value
Optional ¶
- Type:
str
- Default: No value.
Option value.
add_search
¶
def add_search(
searches: str
)
searches
Required ¶
- Type:
str
Properties ¶
hostname_as_fqd_n
Required ¶
hostname_as_fqd_n: bool
- Type:
bool
Whether or not the pods hostname is set to its FQDN.
nameservers
Required ¶
nameservers: typing.List[str]
- Type: typing.List[
str
]
Nameservers defined for this pod.
options
Required ¶
options: typing.List[DnsOption]
- Type: typing.List[
cdk8s_plus_30.DnsOption
]
Custom dns options defined for this pod.
policy
Required ¶
policy: DnsPolicy
- Type:
cdk8s_plus_30.DnsPolicy
The DNS policy of this pod.
searches
Required ¶
searches: typing.List[str]
- Type: typing.List[
str
]
Search domains defined for this pod.
hostname
Optional ¶
hostname: str
- Type:
str
The configured hostname of the pod.
Undefined means its set to a system-defined value.
subdomain
Optional ¶
subdomain: str
- Type:
str
The configured subdomain of the pod.
PodScheduling ¶
Controls the pod scheduling strategy.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.PodScheduling(
instance: AbstractPod
)
instance
Required ¶
Methods ¶
assign
¶
def assign(
node: NamedNode
)
node
Required ¶
- Type:
cdk8s_plus_30.NamedNode
attract
¶
def attract(
node: LabeledNode,
weight: typing.Union[int, float] = None
)
node
Required ¶
weight
Optional ¶
- Type:
typing.Union[int, float]
- Default: no weight. assignment is assumed to be required (hard).
Indicates the attraction is optional (soft), with this weight score.
colocate
¶
def colocate(
selector: IPodSelector,
topology: Topology = None,
weight: typing.Union[int, float] = None
)
selector
Required ¶
topology
Optional ¶
- Type:
cdk8s_plus_30.Topology
- Default: Topology.HOSTNAME
Which topology to coloate on.
weight
Optional ¶
- Type:
typing.Union[int, float]
- Default: no weight. co-location is assumed to be required (hard).
Indicates the co-location is optional (soft), with this weight score.
separate
¶
def separate(
selector: IPodSelector,
topology: Topology = None,
weight: typing.Union[int, float] = None
)
selector
Required ¶
topology
Optional ¶
- Type:
cdk8s_plus_30.Topology
- Default: Topology.HOSTNAME
Which topology to separate on.
weight
Optional ¶
- Type:
typing.Union[int, float]
- Default: no weight. separation is assumed to be required (hard).
Indicates the separation is optional (soft), with this weight score.
tolerate
¶
def tolerate(
node: TaintedNode
)
node
Required ¶
PodSecurityContext ¶
Holds pod-level security attributes and common container settings.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.PodSecurityContext(
ensure_non_root: bool = None,
fs_group: typing.Union[int, float] = None,
fs_group_change_policy: FsGroupChangePolicy = None,
group: typing.Union[int, float] = None,
sysctls: typing.List[Sysctl] = None,
user: typing.Union[int, float] = None
)
ensure_non_root
Optional ¶
- Type:
bool
- Default: true
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.
fs_group
Optional ¶
- Type:
typing.Union[int, float]
- Default: Volume ownership is not changed.
Modify the ownership and permissions of pod volumes to this GID.
fs_group_change_policy
Optional ¶
- Type:
cdk8s_plus_30.FsGroupChangePolicy
- Default: FsGroupChangePolicy.ALWAYS
Defines behavior of changing ownership and permission of the volume before being exposed inside Pod.
This field will only apply to volume types which support fsGroup based ownership(and permissions). It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir.
group
Optional ¶
- Type:
typing.Union[int, float]
- Default: Group configured by container runtime
The GID to run the entrypoint of the container process.
sysctls
Optional ¶
- Type: typing.List[
cdk8s_plus_30.Sysctl
] - Default: No sysctls
Sysctls hold a list of namespaced sysctls used for the pod.
Pods with unsupported sysctls (by the container runtime) might fail to launch.
user
Optional ¶
- Type:
typing.Union[int, float]
- Default: User specified in image metadata
The UID to run the entrypoint of the container process.
Properties ¶
ensure_non_root
Required ¶
ensure_non_root: bool
- Type:
bool
fs_group_change_policy
Required ¶
fs_group_change_policy: FsGroupChangePolicy
sysctls
Required ¶
sysctls: typing.List[Sysctl]
- Type: typing.List[
cdk8s_plus_30.Sysctl
]
fs_group
Optional ¶
fs_group: typing.Union[int, float]
- Type:
typing.Union[int, float]
group
Optional ¶
group: typing.Union[int, float]
- Type:
typing.Union[int, float]
user
Optional ¶
user: typing.Union[int, float]
- Type:
typing.Union[int, float]
Probe ¶
Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.
Static Functions ¶
from_command
¶
import cdk8s_plus_30
cdk8s_plus_30.Probe.from_command(
command: typing.List[str],
failure_threshold: typing.Union[int, float] = None,
initial_delay_seconds: Duration = None,
period_seconds: Duration = None,
success_threshold: typing.Union[int, float] = None,
timeout_seconds: Duration = None
)
command
Required ¶
- Type: typing.List[
str
]
The command to execute.
failure_threshold
Optional ¶
- Type:
typing.Union[int, float]
- Default: 3
Minimum consecutive failures for the probe to be considered failed after having succeeded.
Defaults to 3. Minimum value is 1.
initial_delay_seconds
Optional ¶
- Type:
cdk8s.Duration
- Default: immediate
Number of seconds after the container has started before liveness probes are initiated.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
period_seconds
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(10) Minimum value is 1.
How often (in seconds) to perform the probe.
Default to 10 seconds. Minimum value is 1.
success_threshold
Optional ¶
- Type:
typing.Union[int, float]
- Default: 1 Must be 1 for liveness and startup. Minimum value is 1.
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.
timeout_seconds
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(1)
Number of seconds after which the probe times out.
Defaults to 1 second. Minimum value is 1.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
from_http_get
¶
import cdk8s_plus_30
cdk8s_plus_30.Probe.from_http_get(
path: str,
failure_threshold: typing.Union[int, float] = None,
initial_delay_seconds: Duration = None,
period_seconds: Duration = None,
success_threshold: typing.Union[int, float] = None,
timeout_seconds: Duration = None,
host: str = None,
port: typing.Union[int, float] = None,
scheme: ConnectionScheme = None
)
path
Required ¶
- Type:
str
The URL path to hit.
failure_threshold
Optional ¶
- Type:
typing.Union[int, float]
- Default: 3
Minimum consecutive failures for the probe to be considered failed after having succeeded.
Defaults to 3. Minimum value is 1.
initial_delay_seconds
Optional ¶
- Type:
cdk8s.Duration
- Default: immediate
Number of seconds after the container has started before liveness probes are initiated.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
period_seconds
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(10) Minimum value is 1.
How often (in seconds) to perform the probe.
Default to 10 seconds. Minimum value is 1.
success_threshold
Optional ¶
- Type:
typing.Union[int, float]
- Default: 1 Must be 1 for liveness and startup. Minimum value is 1.
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.
timeout_seconds
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(1)
Number of seconds after which the probe times out.
Defaults to 1 second. Minimum value is 1.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
host
Optional ¶
- Type:
str
- Default: defaults to the pod IP
The host name to connect to on the container.
port
Optional ¶
- Type:
typing.Union[int, float]
- Default: defaults to
container.port
.
The TCP port to use when sending the GET request.
scheme
Optional ¶
- Type:
cdk8s_plus_30.ConnectionScheme
- Default: ConnectionScheme.HTTP
Scheme to use for connecting to the host (HTTP or HTTPS).
from_tcp_socket
¶
import cdk8s_plus_30
cdk8s_plus_30.Probe.from_tcp_socket(
failure_threshold: typing.Union[int, float] = None,
initial_delay_seconds: Duration = None,
period_seconds: Duration = None,
success_threshold: typing.Union[int, float] = None,
timeout_seconds: Duration = None,
host: str = None,
port: typing.Union[int, float] = None
)
failure_threshold
Optional ¶
- Type:
typing.Union[int, float]
- Default: 3
Minimum consecutive failures for the probe to be considered failed after having succeeded.
Defaults to 3. Minimum value is 1.
initial_delay_seconds
Optional ¶
- Type:
cdk8s.Duration
- Default: immediate
Number of seconds after the container has started before liveness probes are initiated.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
period_seconds
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(10) Minimum value is 1.
How often (in seconds) to perform the probe.
Default to 10 seconds. Minimum value is 1.
success_threshold
Optional ¶
- Type:
typing.Union[int, float]
- Default: 1 Must be 1 for liveness and startup. Minimum value is 1.
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.
timeout_seconds
Optional ¶
- Type:
cdk8s.Duration
- Default: Duration.seconds(1)
Number of seconds after which the probe times out.
Defaults to 1 second. Minimum value is 1.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
host
Optional ¶
- Type:
str
- Default: defaults to the pod IP
The host name to connect to on the container.
port
Optional ¶
- Type:
typing.Union[int, float]
- Default: defaults to
container.port
.
The TCP port to connect to on the container.
Replicas ¶
The amount of replicas that will change.
Static Functions ¶
absolute
¶
import cdk8s_plus_30
cdk8s_plus_30.Replicas.absolute(
value: typing.Union[int, float]
)
value
Required ¶
- Type:
typing.Union[int, float]
The amount of change to apply.
Must be greater than 0.
percent
¶
import cdk8s_plus_30
cdk8s_plus_30.Replicas.percent(
value: typing.Union[int, float]
)
value
Required ¶
- Type:
typing.Union[int, float]
The percentage of change to apply.
Must be greater than 0.
ResourcePermissions ¶
Controls permissions for operations on resources.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.ResourcePermissions(
instance: Resource
)
instance
Required ¶
- Type:
cdk8s_plus_30.Resource
Methods ¶
grant_read
¶
def grant_read(
subjects: ISubject
)
subjects
Required ¶
- Type:
cdk8s_plus_30.ISubject
grant_read_write
¶
def grant_read_write(
subjects: ISubject
)
subjects
Required ¶
- Type:
cdk8s_plus_30.ISubject
StatefulSetUpdateStrategy ¶
StatefulSet update strategies.
Static Functions ¶
on_delete
¶
import cdk8s_plus_30
cdk8s_plus_30.StatefulSetUpdateStrategy.on_delete()
rolling_update
¶
import cdk8s_plus_30
cdk8s_plus_30.StatefulSetUpdateStrategy.rolling_update(
partition: typing.Union[int, float] = None
)
partition
Optional ¶
- Type:
typing.Union[int, float]
- Default: 0
If specified, all Pods with an ordinal that is greater than or equal to the partition will be updated when the StatefulSet’s .spec.template is updated. All Pods with an ordinal that is less than the partition will not be updated, and, even if they are deleted, they will be recreated at the previous version.
If the partition is greater than replicas, updates to the pod template will not be propagated to Pods. In most cases you will not need to use a partition, but they are useful if you want to stage an update, roll out a canary, or perform a phased roll out.
https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions
TaintedNode ¶
A node that is matched by taint selectors.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.TaintedNode(
taint_selector: typing.List[NodeTaintQuery]
)
taint_selector
Required ¶
- Type: typing.List[
cdk8s_plus_30.NodeTaintQuery
]
Properties ¶
taint_selector
Required ¶
taint_selector: typing.List[NodeTaintQuery]
- Type: typing.List[
cdk8s_plus_30.NodeTaintQuery
]
Topology ¶
Available topology domains.
Static Functions ¶
custom
¶
import cdk8s_plus_30
cdk8s_plus_30.Topology.custom(
key: str
)
key
Required ¶
- Type:
str
Properties ¶
key
Required ¶
key: str
- Type:
str
Constants ¶
HOSTNAME
¶
- Type:
cdk8s_plus_30.Topology
A hostname represents a single node in the cluster.
https://kubernetes.io/docs/reference/labels-annotations-taints/#kubernetesiohostname
REGION
¶
- Type:
cdk8s_plus_30.Topology
A region represents a larger domain, made up of one or more zones.
It is uncommon for Kubernetes clusters to span multiple regions. While the exact definition of a zone or region is left to infrastructure implementations, common properties of a region include higher network latency between them than within them, non-zero cost for network traffic between them, and failure independence from other zones or regions.
For example, nodes within a region might share power infrastructure (e.g. a UPS or generator), but nodes in different regions typically would not.
https://kubernetes.io/docs/reference/labels-annotations-taints/#topologykubernetesioregion
ZONE
¶
- Type:
cdk8s_plus_30.Topology
A zone represents a logical failure domain.
It is common for Kubernetes clusters to span multiple zones for increased availability. While the exact definition of a zone is left to infrastructure implementations, common properties of a zone include very low network latency within a zone, no-cost network traffic within a zone, and failure independence from other zones. For example, nodes within a zone might share a network switch, but nodes in different zones should not.
https://kubernetes.io/docs/reference/labels-annotations-taints/#topologykubernetesiozone
WorkloadScheduling ¶
Controls the pod scheduling strategy of this workload.
It offers some additional API’s on top of the core pod scheduling.
Initializers ¶
import cdk8s_plus_30
cdk8s_plus_30.WorkloadScheduling(
instance: AbstractPod
)
instance
Required ¶
Methods ¶
spread
¶
def spread(
topology: Topology = None,
weight: typing.Union[int, float] = None
)
topology
Optional ¶
- Type:
cdk8s_plus_30.Topology
- Default: Topology.HOSTNAME
Which topology to spread on.
weight
Optional ¶
- Type:
typing.Union[int, float]
- Default: no weight. spread is assumed to be required.
Indicates the spread is optional, with this weight score.
Protocols ¶
IApiEndpoint ¶
- Implemented By:
cdk8s_plus_30.AbstractPod
,cdk8s_plus_30.ApiResource
,cdk8s_plus_30.AwsElasticBlockStorePersistentVolume
,cdk8s_plus_30.AzureDiskPersistentVolume
,cdk8s_plus_30.BasicAuthSecret
,cdk8s_plus_30.ClusterRole
,cdk8s_plus_30.ClusterRoleBinding
,cdk8s_plus_30.ConfigMap
,cdk8s_plus_30.CronJob
,cdk8s_plus_30.DaemonSet
,cdk8s_plus_30.Deployment
,cdk8s_plus_30.DockerConfigSecret
,cdk8s_plus_30.GCEPersistentDiskPersistentVolume
,cdk8s_plus_30.HorizontalPodAutoscaler
,cdk8s_plus_30.Ingress
,cdk8s_plus_30.Job
,cdk8s_plus_30.Namespace
,cdk8s_plus_30.NetworkPolicy
,cdk8s_plus_30.NonApiResource
,cdk8s_plus_30.PersistentVolume
,cdk8s_plus_30.PersistentVolumeClaim
,cdk8s_plus_30.Pod
,cdk8s_plus_30.Resource
,cdk8s_plus_30.Role
,cdk8s_plus_30.RoleBinding
,cdk8s_plus_30.Secret
,cdk8s_plus_30.Service
,cdk8s_plus_30.ServiceAccount
,cdk8s_plus_30.ServiceAccountTokenSecret
,cdk8s_plus_30.SshAuthSecret
,cdk8s_plus_30.StatefulSet
,cdk8s_plus_30.TlsSecret
,cdk8s_plus_30.Workload
,cdk8s_plus_30.IApiEndpoint
An API Endpoint can either be a resource descriptor (e.g /pods) or a non resource url (e.g /healthz). It must be one or the other, and not both.
Methods ¶
as_api_resource
¶
def as_api_resource()
as_non_api_resource
¶
def as_non_api_resource()
IApiResource ¶
- Implemented By:
cdk8s_plus_30.AbstractPod
,cdk8s_plus_30.ApiResource
,cdk8s_plus_30.AwsElasticBlockStorePersistentVolume
,cdk8s_plus_30.AzureDiskPersistentVolume
,cdk8s_plus_30.BasicAuthSecret
,cdk8s_plus_30.ClusterRole
,cdk8s_plus_30.ClusterRoleBinding
,cdk8s_plus_30.ConfigMap
,cdk8s_plus_30.CronJob
,cdk8s_plus_30.DaemonSet
,cdk8s_plus_30.Deployment
,cdk8s_plus_30.DockerConfigSecret
,cdk8s_plus_30.GCEPersistentDiskPersistentVolume
,cdk8s_plus_30.HorizontalPodAutoscaler
,cdk8s_plus_30.Ingress
,cdk8s_plus_30.Job
,cdk8s_plus_30.Namespace
,cdk8s_plus_30.NetworkPolicy
,cdk8s_plus_30.PersistentVolume
,cdk8s_plus_30.PersistentVolumeClaim
,cdk8s_plus_30.Pod
,cdk8s_plus_30.Resource
,cdk8s_plus_30.Role
,cdk8s_plus_30.RoleBinding
,cdk8s_plus_30.Secret
,cdk8s_plus_30.Service
,cdk8s_plus_30.ServiceAccount
,cdk8s_plus_30.ServiceAccountTokenSecret
,cdk8s_plus_30.SshAuthSecret
,cdk8s_plus_30.StatefulSet
,cdk8s_plus_30.TlsSecret
,cdk8s_plus_30.Workload
,cdk8s_plus_30.IApiResource
,cdk8s_plus_30.IClusterRole
,cdk8s_plus_30.IConfigMap
,cdk8s_plus_30.IPersistentVolume
,cdk8s_plus_30.IPersistentVolumeClaim
,cdk8s_plus_30.IResource
,cdk8s_plus_30.IRole
,cdk8s_plus_30.ISecret
,cdk8s_plus_30.IServiceAccount
Represents a resource or collection of resources.
Properties ¶
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
IClusterRole ¶
-
Extends:
cdk8s_plus_30.IResource
-
Implemented By:
cdk8s_plus_30.ClusterRole
,cdk8s_plus_30.IClusterRole
Represents a cluster-level role.
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
name
Required ¶
name: str
- Type:
str
The Kubernetes name of this resource.
IConfigMap ¶
-
Extends:
cdk8s_plus_30.IResource
-
Implemented By:
cdk8s_plus_30.ConfigMap
,cdk8s_plus_30.IConfigMap
Represents a config map.
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
name
Required ¶
name: str
- Type:
str
The Kubernetes name of this resource.
INamespaceSelector ¶
-
Extends:
constructs.IConstruct
-
Implemented By:
cdk8s_plus_30.Namespace
,cdk8s_plus_30.Namespaces
,cdk8s_plus_30.INamespaceSelector
Represents an object that can select namespaces.
Methods ¶
to_namespace_selector_config
¶
def to_namespace_selector_config()
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
INetworkPolicyPeer ¶
-
Extends:
constructs.IConstruct
-
Implemented By:
cdk8s_plus_30.AbstractPod
,cdk8s_plus_30.CronJob
,cdk8s_plus_30.DaemonSet
,cdk8s_plus_30.Deployment
,cdk8s_plus_30.Job
,cdk8s_plus_30.Namespace
,cdk8s_plus_30.Namespaces
,cdk8s_plus_30.NetworkPolicyIpBlock
,cdk8s_plus_30.Pod
,cdk8s_plus_30.StatefulSet
,cdk8s_plus_30.Workload
,cdk8s_plus_30.INetworkPolicyPeer
Describes a peer to allow traffic to/from.
Methods ¶
to_network_policy_peer_config
¶
def to_network_policy_peer_config()
to_pod_selector
¶
def to_pod_selector()
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
IPersistentVolume ¶
-
Extends:
cdk8s_plus_30.IResource
-
Implemented By:
cdk8s_plus_30.AwsElasticBlockStorePersistentVolume
,cdk8s_plus_30.AzureDiskPersistentVolume
,cdk8s_plus_30.GCEPersistentDiskPersistentVolume
,cdk8s_plus_30.PersistentVolume
,cdk8s_plus_30.IPersistentVolume
Contract of a PersistentVolumeClaim
.
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
name
Required ¶
name: str
- Type:
str
The Kubernetes name of this resource.
IPersistentVolumeClaim ¶
-
Extends:
cdk8s_plus_30.IResource
-
Implemented By:
cdk8s_plus_30.PersistentVolumeClaim
,cdk8s_plus_30.IPersistentVolumeClaim
Contract of a PersistentVolumeClaim
.
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
name
Required ¶
name: str
- Type:
str
The Kubernetes name of this resource.
IPodSelector ¶
-
Extends:
constructs.IConstruct
-
Implemented By:
cdk8s_plus_30.AbstractPod
,cdk8s_plus_30.CronJob
,cdk8s_plus_30.DaemonSet
,cdk8s_plus_30.Deployment
,cdk8s_plus_30.Job
,cdk8s_plus_30.Pod
,cdk8s_plus_30.Pods
,cdk8s_plus_30.StatefulSet
,cdk8s_plus_30.Workload
,cdk8s_plus_30.IPodSelector
Represents an object that can select pods.
Methods ¶
to_pod_selector_config
¶
def to_pod_selector_config()
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
IResource ¶
-
Implemented By:
cdk8s_plus_30.AbstractPod
,cdk8s_plus_30.AwsElasticBlockStorePersistentVolume
,cdk8s_plus_30.AzureDiskPersistentVolume
,cdk8s_plus_30.BasicAuthSecret
,cdk8s_plus_30.ClusterRole
,cdk8s_plus_30.ClusterRoleBinding
,cdk8s_plus_30.ConfigMap
,cdk8s_plus_30.CronJob
,cdk8s_plus_30.DaemonSet
,cdk8s_plus_30.Deployment
,cdk8s_plus_30.DockerConfigSecret
,cdk8s_plus_30.GCEPersistentDiskPersistentVolume
,cdk8s_plus_30.HorizontalPodAutoscaler
,cdk8s_plus_30.Ingress
,cdk8s_plus_30.Job
,cdk8s_plus_30.Namespace
,cdk8s_plus_30.NetworkPolicy
,cdk8s_plus_30.PersistentVolume
,cdk8s_plus_30.PersistentVolumeClaim
,cdk8s_plus_30.Pod
,cdk8s_plus_30.Resource
,cdk8s_plus_30.Role
,cdk8s_plus_30.RoleBinding
,cdk8s_plus_30.Secret
,cdk8s_plus_30.Service
,cdk8s_plus_30.ServiceAccount
,cdk8s_plus_30.ServiceAccountTokenSecret
,cdk8s_plus_30.SshAuthSecret
,cdk8s_plus_30.StatefulSet
,cdk8s_plus_30.TlsSecret
,cdk8s_plus_30.Workload
,cdk8s_plus_30.IClusterRole
,cdk8s_plus_30.IConfigMap
,cdk8s_plus_30.IPersistentVolume
,cdk8s_plus_30.IPersistentVolumeClaim
,cdk8s_plus_30.IResource
,cdk8s_plus_30.IRole
,cdk8s_plus_30.ISecret
,cdk8s_plus_30.IServiceAccount
Represents a resource.
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
name
Required ¶
name: str
- Type:
str
The Kubernetes name of this resource.
IRole ¶
-
Extends:
cdk8s_plus_30.IResource
-
Implemented By:
cdk8s_plus_30.ClusterRole
,cdk8s_plus_30.Role
,cdk8s_plus_30.IRole
A reference to any Role or ClusterRole.
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
name
Required ¶
name: str
- Type:
str
The Kubernetes name of this resource.
IScalable ¶
- Implemented By:
cdk8s_plus_30.Deployment
,cdk8s_plus_30.StatefulSet
,cdk8s_plus_30.IScalable
Represents a scalable workload.
Methods ¶
mark_has_autoscaler
¶
def mark_has_autoscaler()
to_scaling_target
¶
def to_scaling_target()
Properties ¶
has_autoscaler
Required ¶
has_autoscaler: bool
- Type:
bool
If this is a target of an autoscaler.
ISecret ¶
-
Extends:
cdk8s_plus_30.IResource
-
Implemented By:
cdk8s_plus_30.BasicAuthSecret
,cdk8s_plus_30.DockerConfigSecret
,cdk8s_plus_30.Secret
,cdk8s_plus_30.ServiceAccountTokenSecret
,cdk8s_plus_30.SshAuthSecret
,cdk8s_plus_30.TlsSecret
,cdk8s_plus_30.ISecret
Methods ¶
env_value
¶
def env_value(
key: str,
optional: bool = None
)
key
Required ¶
- Type:
str
Secret’s key.
optional
Optional ¶
- Type:
bool
- Default: false
Specify whether the Secret or its key must be defined.
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
name
Required ¶
name: str
- Type:
str
The Kubernetes name of this resource.
IServiceAccount ¶
-
Implemented By:
cdk8s_plus_30.ServiceAccount
,cdk8s_plus_30.IServiceAccount
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
api_group
Required ¶
api_group: str
- Type:
str
The group portion of the API version (e.g. authorization.k8s.io
).
resource_type
Required ¶
resource_type: str
- Type:
str
The name of a resource type as it appears in the relevant API endpoint.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
resource_name
Optional ¶
resource_name: str
- Type:
str
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
api_version
Required ¶
api_version: str
- Type:
str
The object’s API version (e.g. “authorization.k8s.io/v1”).
kind
Required ¶
kind: str
- Type:
str
The object kind (e.g. “Deployment”).
name
Required ¶
name: str
- Type:
str
The Kubernetes name of this resource.
IStorage ¶
-
Extends:
constructs.IConstruct
-
Implemented By:
cdk8s_plus_30.AwsElasticBlockStorePersistentVolume
,cdk8s_plus_30.AzureDiskPersistentVolume
,cdk8s_plus_30.GCEPersistentDiskPersistentVolume
,cdk8s_plus_30.PersistentVolume
,cdk8s_plus_30.Volume
,cdk8s_plus_30.IStorage
Represents a piece of storage in the cluster.
Methods ¶
as_volume
¶
def as_volume()
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
ISubject ¶
-
Extends:
constructs.IConstruct
-
Implemented By:
cdk8s_plus_30.AbstractPod
,cdk8s_plus_30.CronJob
,cdk8s_plus_30.DaemonSet
,cdk8s_plus_30.Deployment
,cdk8s_plus_30.Group
,cdk8s_plus_30.Job
,cdk8s_plus_30.Pod
,cdk8s_plus_30.ServiceAccount
,cdk8s_plus_30.StatefulSet
,cdk8s_plus_30.User
,cdk8s_plus_30.Workload
,cdk8s_plus_30.IServiceAccount
,cdk8s_plus_30.ISubject
Represents an object that can be used as a role binding subject.
Methods ¶
to_subject_configuration
¶
def to_subject_configuration()
Properties ¶
node
Required ¶
node: Node
- Type:
constructs.Node
The tree node.
Enums ¶
AzureDiskPersistentVolumeCachingMode ¶
Azure disk caching modes.
NONE
¶
None.
READ_ONLY
¶
ReadOnly.
READ_WRITE
¶
ReadWrite.
AzureDiskPersistentVolumeKind ¶
Azure Disk kinds.
SHARED
¶
Multiple blob disks per storage account.
DEDICATED
¶
Single blob disk per storage account.
MANAGED
¶
Azure managed data disk.
Capability ¶
Capability - complete list of POSIX capabilities.
ALL
¶
ALL.
AUDIT_CONTROL
¶
CAP_AUDIT_CONTROL.
AUDIT_READ
¶
CAP_AUDIT_READ.
AUDIT_WRITE
¶
CAP_AUDIT_WRITE.
BLOCK_SUSPEND
¶
CAP_BLOCK_SUSPEND.
BPF
¶
CAP_BPF.
CHECKPOINT_RESTORE
¶
CAP_CHECKPOINT_RESTORE.
CHOWN
¶
CAP_CHOWN.
DAC_OVERRIDE
¶
CAP_DAC_OVERRIDE.
DAC_READ_SEARCH
¶
CAP_DAC_READ_SEARCH.
FOWNER
¶
CAP_FOWNER.
FSETID
¶
CAP_FSETID.
IPC_LOCK
¶
CAP_IPC_LOCK.
IPC_OWNER
¶
CAP_IPC_OWNER.
KILL
¶
CAP_KILL.
LEASE
¶
CAP_LEASE.
LINUX_IMMUTABLE
¶
CAP_LINUX_IMMUTABLE.
MAC_ADMIN
¶
CAP_MAC_ADMIN.
MAC_OVERRIDE
¶
CAP_MAC_OVERRIDE.
MKNOD
¶
CAP_MKNOD.
NET_ADMIN
¶
CAP_NET_ADMIN.
NET_BIND_SERVICE
¶
CAP_NET_BIND_SERVICE.
NET_BROADCAST
¶
CAP_NET_BROADCAST.
NET_RAW
¶
CAP_NET_RAW.
PERFMON
¶
CAP_PERFMON.
SETGID
¶
CAP_SETGID.
SETFCAP
¶
CAP_SETFCAP.
SETPCAP
¶
CAP_SETPCAP.
SETUID
¶
CAP_SETUID.
SYS_ADMIN
¶
CAP_SYS_ADMIN.
SYS_BOOT
¶
CAP_SYS_BOOT.
SYS_CHROOT
¶
CAP_SYS_CHROOT.
SYS_MODULE
¶
CAP_SYS_MODULE.
SYS_NICE
¶
CAP_SYS_NICE.
SYS_PACCT
¶
CAP_SYS_PACCT.
SYS_PTRACE
¶
CAP_SYS_PTRACE.
SYS_RAWIO
¶
CAP_SYS_RAWIO.
SYS_RESOURCE
¶
CAP_SYS_RESOURCE.
SYS_TIME
¶
CAP_SYS_TIME.
SYS_TTY_CONFIG
¶
CAP_SYS_TTY_CONFIG.
SYSLOG
¶
CAP_SYSLOG.
WAKE_ALARM
¶
CAP_WAKE_ALARM.
ConcurrencyPolicy ¶
Concurrency policy for CronJobs.
ALLOW
¶
This policy allows to run job concurrently.
FORBID
¶
This policy does not allow to run job concurrently.
It does not let a new job to be scheduled if the previous one is not finished yet.
REPLACE
¶
This policy replaces the currently running job if a new job is being scheduled.
ConnectionScheme ¶
HTTP
¶
Use HTTP request for connecting to host.
HTTPS
¶
Use HTTPS request for connecting to host.
ContainerRestartPolicy ¶
RestartPolicy defines the restart behavior of individual containers in a pod.
This field may only be set for init containers, and the only allowed value is “Always”. For non-init containers or when this field is not specified, the restart behavior is defined by the Pod’s restart policy and the container type. 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.
https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
ALWAYS
¶
If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod.
For regular containers, this is ignored by Kubernetes.
DnsPolicy ¶
Pod DNS policies.
CLUSTER_FIRST
¶
Any DNS query that does not match the configured cluster domain suffix, such as “www.kubernetes.io”, is forwarded to the upstream nameserver inherited from the node. Cluster administrators may have extra stub-domain and upstream DNS servers configured.
CLUSTER_FIRST_WITH_HOST_NET
¶
For Pods running with hostNetwork, you should explicitly set its DNS policy “ClusterFirstWithHostNet”.
DEFAULT
¶
The Pod inherits the name resolution configuration from the node that the pods run on.
NONE
¶
It allows a Pod to ignore DNS settings from the Kubernetes environment.
All DNS settings are supposed to be provided using the dnsConfig field in the Pod Spec.
EmptyDirMedium ¶
The medium on which to store the volume.
DEFAULT
¶
The default volume of the backing node.
MEMORY
¶
Mount a tmpfs (RAM-backed filesystem) for you instead.
While tmpfs is very fast, be aware that unlike disks, tmpfs is cleared on node reboot and any files you write will count against your Container’s memory limit.
EnvFieldPaths ¶
POD_NAME
¶
The name of the pod.
POD_NAMESPACE
¶
The namespace of the pod.
POD_UID
¶
The uid of the pod.
POD_LABEL
¶
The labels of the pod.
POD_ANNOTATION
¶
The annotations of the pod.
POD_IP
¶
The ipAddress of the pod.
SERVICE_ACCOUNT_NAME
¶
The service account name of the pod.
NODE_NAME
¶
The name of the node.
NODE_IP
¶
The ipAddress of the node.
POD_IPS
¶
The ipAddresess of the pod.
FsGroupChangePolicy ¶
ON_ROOT_MISMATCH
¶
Only change permissions and ownership if permission and ownership of root directory does not match with expected permissions of the volume.
This could help shorten the time it takes to change ownership and permission of a volume
ALWAYS
¶
Always change permission and ownership of the volume when volume is mounted.
HostPathVolumeType ¶
Host path types.
DEFAULT
¶
Empty string (default) is for backward compatibility, which means that no checks will be performed before mounting the hostPath volume.
DIRECTORY_OR_CREATE
¶
If nothing exists at the given path, an empty directory will be created there as needed with permission set to 0755, having the same group and ownership with Kubelet.
DIRECTORY
¶
A directory must exist at the given path.
FILE_OR_CREATE
¶
If nothing exists at the given path, an empty file will be created there as needed with permission set to 0644, having the same group and ownership with Kubelet.
FILE
¶
A file must exist at the given path.
SOCKET
¶
A UNIX socket must exist at the given path.
CHAR_DEVICE
¶
A character device must exist at the given path.
BLOCK_DEVICE
¶
A block device must exist at the given path.
HttpIngressPathType ¶
Specify how the path is matched against request paths.
https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
PREFIX
¶
Matches the URL path exactly.
EXACT
¶
Matches based on a URL path prefix split by ‘/’.
IMPLEMENTATION_SPECIFIC
¶
Matching is specified by the underlying IngressClass.
ImagePullPolicy ¶
ALWAYS
¶
Every time the kubelet launches a container, the kubelet queries the container image registry to resolve the name to an image digest.
If the kubelet has a container image with that exact digest cached locally, the kubelet uses its cached image; otherwise, the kubelet downloads (pulls) the image with the resolved digest, and uses that image to launch the container.
Default is Always if ImagePullPolicy is omitted and either the image tag is :latest or the image tag is omitted.
IF_NOT_PRESENT
¶
The image is pulled only if it is not already present locally.
Default is IfNotPresent if ImagePullPolicy is omitted and the image tag is present but not :latest
NEVER
¶
The image is assumed to exist locally.
No attempt is made to pull the image.
MountPropagation ¶
NONE
¶
This volume mount will not receive any subsequent mounts that are mounted to this volume or any of its subdirectories by the host.
In similar fashion, no mounts created by the Container will be visible on the host.
This is the default mode.
This mode is equal to private
mount propagation as described in the Linux
kernel documentation
HOST_TO_CONTAINER
¶
This volume mount will receive all subsequent mounts that are mounted to this volume or any of its subdirectories.
In other words, if the host mounts anything inside the volume mount, the Container will see it mounted there.
Similarly, if any Pod with Bidirectional mount propagation to the same volume mounts anything there, the Container with HostToContainer mount propagation will see it.
This mode is equal to rslave
mount propagation as described in the Linux
kernel documentation
BIDIRECTIONAL
¶
This volume mount behaves the same the HostToContainer mount.
In addition, all volume mounts created by the Container will be propagated back to the host and to all Containers of all Pods that use the same volume
A typical use case for this mode is a Pod with a FlexVolume or CSI driver or a Pod that needs to mount something on the host using a hostPath volume.
This mode is equal to rshared
mount propagation as described in the Linux
kernel documentation
Caution: Bidirectional mount propagation can be dangerous. It can damage the host operating system and therefore it is allowed only in privileged Containers. Familiarity with Linux kernel behavior is strongly recommended. In addition, any volume mounts created by Containers in Pods must be destroyed (unmounted) by the Containers on termination.
NetworkPolicyTrafficDefault ¶
Default behaviors of network traffic in policies.
DENY
¶
The policy denies all traffic.
Since rules are additive, additional rules or policies can allow specific traffic.
ALLOW
¶
The policy allows all traffic (either ingress or egress).
Since rules are additive, no additional rule or policies can subsequently deny the traffic.
NetworkProtocol ¶
Network protocols.
TCP
¶
TCP.
UDP
¶
UDP.
SCTP
¶
SCTP.
PersistentVolumeAccessMode ¶
Access Modes.
READ_WRITE_ONCE
¶
The volume can be mounted as read-write by a single node.
ReadWriteOnce access mode still can allow multiple pods to access the volume when the pods are running on the same node.
READ_ONLY_MANY
¶
The volume can be mounted as read-only by many nodes.
READ_WRITE_MANY
¶
The volume can be mounted as read-write by many nodes.
READ_WRITE_ONCE_POD
¶
The volume can be mounted as read-write by a single Pod.
Use ReadWriteOncePod access mode if you want to ensure that only one pod across whole cluster can read that PVC or write to it. This is only supported for CSI volumes and Kubernetes version 1.22+.
PersistentVolumeMode ¶
Volume Modes.
FILE_SYSTEM
¶
Volume is ounted into Pods into a directory.
If the volume is backed by a block device and the device is empty, Kubernetes creates a filesystem on the device before mounting it for the first time.
BLOCK
¶
Use a volume as a raw block device.
Such volume is presented into a Pod as a block device, without any filesystem on it. This mode is useful to provide a Pod the fastest possible way to access a volume, without any filesystem layer between the Pod and the volume. On the other hand, the application running in the Pod must know how to handle a raw block device
PersistentVolumeReclaimPolicy ¶
Reclaim Policies.
RETAIN
¶
The Retain reclaim policy allows for manual reclamation of the resource.
When the PersistentVolumeClaim is deleted, the PersistentVolume still exists and the volume is considered “released”. But it is not yet available for another claim because the previous claimant’s data remains on the volume. An administrator can manually reclaim the volume with the following steps:
- Delete the PersistentVolume. The associated storage asset in external infrastructure (such as an AWS EBS, GCE PD, Azure Disk, or Cinder volume) still exists after the PV is deleted.
- Manually clean up the data on the associated storage asset accordingly.
- Manually delete the associated storage asset.
If you want to reuse the same storage asset, create a new PersistentVolume with the same storage asset definition.
DELETE
¶
For volume plugins that support the Delete reclaim policy, deletion removes both the PersistentVolume object from Kubernetes, as well as the associated storage asset in the external infrastructure, such as an AWS EBS, GCE PD, Azure Disk, or Cinder volume.
Volumes that were dynamically provisioned inherit the reclaim policy of their StorageClass, which defaults to Delete. The administrator should configure the StorageClass according to users’ expectations; otherwise, the PV must be edited or patched after it is created
PodConnectionsIsolation ¶
Isolation determines which policies are created when allowing connections from a a pod / workload to peers.
POD
¶
Only creates network policies that select the pod.
PEER
¶
Only creates network policies that select the peer.
PodManagementPolicy ¶
Controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down.
The default policy is OrderedReady
, where pods are created in increasing order
(pod-0, then pod-1, etc) and the controller will wait until each pod is ready before
continuing. When scaling down, the pods are removed in the opposite order.
The alternative policy is Parallel
which will create pods in parallel to match the
desired scale without waiting, and on scale down will delete all pods at once.
ORDERED_READY
¶
PARALLEL
¶
Protocol ¶
Network protocols.
TCP
¶
TCP.
UDP
¶
UDP.
SCTP
¶
SCTP.
ResourceFieldPaths ¶
CPU_LIMIT
¶
CPU limit of the container.
MEMORY_LIMIT
¶
Memory limit of the container.
CPU_REQUEST
¶
CPU request of the container.
MEMORY_REQUEST
¶
Memory request of the container.
STORAGE_LIMIT
¶
Ephemeral storage limit of the container.
STORAGE_REQUEST
¶
Ephemeral storage request of the container.
RestartPolicy ¶
Restart policy for all containers within the pod.
ALWAYS
¶
Always restart the pod after it exits.
ON_FAILURE
¶
Only restart if the pod exits with a non-zero exit code.
NEVER
¶
Never restart the pod.
ScalingStrategy ¶
MAX_CHANGE
¶
Use the policy that provisions the most changes.
MIN_CHANGE
¶
Use the policy that provisions the least amount of changes.
~~DISABLED
~~ ¶
- Deprecated: - Omit the ScalingRule instead
Disables scaling in this direction.
SeccompProfileType ¶
LOCALHOST
¶
A profile defined in a file on the node should be used.
RUNTIME_DEFAULT
¶
The container runtime default profile should be used.
UNCONFINED
¶
No profile should be applied.
ServiceType ¶
For some parts of your application (for example, frontends) you may want to expose a Service onto an external IP address, that’s outside of your cluster.
Kubernetes ServiceTypes allow you to specify what kind of Service you want. The default is ClusterIP.
CLUSTER_IP
¶
Exposes the Service on a cluster-internal IP.
Choosing this value makes the Service only reachable from within the cluster. This is the default ServiceType
NODE_PORT
¶
Exposes the Service on each Node’s IP at a static port (the NodePort).
A ClusterIP Service, to which the NodePort Service routes, is automatically created.
You’ll be able to contact the NodePort Service, from outside the cluster,
by requesting
LOAD_BALANCER
¶
Exposes the Service externally using a cloud provider’s load balancer.
NodePort and ClusterIP Services, to which the external load balancer routes, are automatically created.
EXTERNAL_NAME
¶
Maps the Service to the contents of the externalName field (e.g. foo.bar.example.com), by returning a CNAME record with its value. No proxying of any kind is set up.
Note: You need either kube-dns version 1.7 or CoreDNS version 0.0.8 or higher to use the ExternalName type.
TaintEffect ¶
Taint effects.
NO_SCHEDULE
¶
This means that no pod will be able to schedule onto the node unless it has a matching toleration.
PREFER_NO_SCHEDULE
¶
This is a “preference” or “soft” version of NO_SCHEDULE
– the system will try to avoid placing a pod that does not tolerate the taint on the node, but it is not required.
NO_EXECUTE
¶
This affects pods that are already running on the node as follows:.
- Pods that do not tolerate the taint are evicted immediately.
- Pods that tolerate the taint without specifying
duration
remain bound forever. - Pods that tolerate the taint with a specified
duration
remain bound for the specified amount of time.