# Kubernetes Tasks


Tasks for interacting with various Kubernetes API objects.

Note that depending on how you choose to authenticate, tasks in this collection might require a Prefect Secret called "KUBERNETES_API_KEY" that stores your Kubernetes API Key; this Secret must be a string and in BearerToken format.

# CreateNamespacedDeployment

class

prefect.tasks.kubernetes.deployment.CreateNamespacedDeployment

(body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for creating a namespaced deployment on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • body (dict, optional): A dictionary representation of a Kubernetes ExtensionsV1beta1Deployment specification
  • namespace (str, optional): The Kubernetes namespace to create this deployment in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.deployment.CreateNamespacedDeployment.run

(body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • body (dict, optional): A dictionary representation of a Kubernetes ExtensionsV1beta1Deployment specification
  • namespace (str, optional): The Kubernetes namespace to create this deployment in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None



# DeleteNamespacedDeployment

class

prefect.tasks.kubernetes.deployment.DeleteNamespacedDeployment

(deployment_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for deleting a namespaced deployment on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • deployment_name (str, optional): The name of a deployment to delete
  • namespace (str, optional): The Kubernetes namespace to delete this deployment from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.deployment.DeleteNamespacedDeployment.run

(deployment_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", delete_option_kwargs=None)[source]

Task run method.

Args:

  • deployment_name (str, optional): The name of a deployment to delete
  • namespace (str, optional): The Kubernetes namespace to delete this deployment in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • delete_option_kwargs (dict, optional): Optional keyword arguments to pass to the V1DeleteOptions object (e.g. {"propagation_policy": "...", "grace_period_seconds": "..."}.
Raises:
  • ValueError: if deployment_name is None



# ListNamespacedDeployment

class

prefect.tasks.kubernetes.deployment.ListNamespacedDeployment

(namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for listing namespaced deployments on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • namespace (str, optional): The Kubernetes namespace to list deployments from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"field_selector": "...", "label_selector": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.deployment.ListNamespacedDeployment.run

(namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • namespace (str, optional): The Kubernetes namespace to list deployments from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"field_selector": "...", "label_selector": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Returns:
  • ExtensionsV1beta1DeploymentList: a Kubernetes ExtensionsV1beta1DeploymentList of the deployments which are found



# PatchNamespacedDeployment

class

prefect.tasks.kubernetes.deployment.PatchNamespacedDeployment

(deployment_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for patching a namespaced deployment on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • deployment_name (str, optional): The name of a deployment to patch
  • body (dict, optional): A dictionary representation of a Kubernetes ExtensionsV1beta1Deployment patch specification
  • namespace (str, optional): The Kubernetes namespace to patch this deployment in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.deployment.PatchNamespacedDeployment.run

(deployment_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • deployment_name (str, optional): The name of a deployment to patch
  • body (dict, optional): A dictionary representation of a Kubernetes ExtensionsV1beta1Deployment patch specification
  • namespace (str, optional): The Kubernetes namespace to patch this deployment in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None
  • ValueError: if deployment_name is None



# ReadNamespacedDeployment

class

prefect.tasks.kubernetes.deployment.ReadNamespacedDeployment

(deployment_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for reading a namespaced deployment on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • deployment_name (str, optional): The name of a deployment to read
  • namespace (str, optional): The Kubernetes namespace to read this deployment from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "exact": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.deployment.ReadNamespacedDeployment.run

(deployment_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • deployment_name (str, optional): The name of a deployment to read
  • namespace (str, optional): The Kubernetes namespace to read this deployment in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "exact": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Returns:
  • ExtensionsV1beta1Deployment: a Kubernetes ExtensionsV1beta1Deployment matching the deployment that was found
Raises:
  • ValueError: if deployment_name is None



# ReplaceNamespacedDeployment

class

prefect.tasks.kubernetes.deployment.ReplaceNamespacedDeployment

(deployment_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for replacing a namespaced deployment on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • deployment_name (str, optional): The name of a deployment to replace
  • body (dict, optional): A dictionary representation of a Kubernetes ExtensionsV1beta1Deployment specification
  • namespace (str, optional): The Kubernetes namespace to patch this deployment in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.deployment.ReplaceNamespacedDeployment.run

(deployment_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • deployment_name (str, optional): The name of a deployment to replace
  • body (dict, optional): A dictionary representation of a Kubernetes ExtensionsV1beta1Deployment specification
  • namespace (str, optional): The Kubernetes namespace to patch this deployment in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None
  • ValueError: if deployment_name is None



# CreateNamespacedJob

class

prefect.tasks.kubernetes.job.CreateNamespacedJob

(body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for creating a namespaced job on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • body (dict, optional): A dictionary representation of a Kubernetes V1Job specification
  • namespace (str, optional): The Kubernetes namespace to create this job in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.job.CreateNamespacedJob.run

(body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • body (dict, optional): A dictionary representation of a Kubernetes V1Job specification
  • namespace (str, optional): The Kubernetes namespace to create this job in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None



# DeleteNamespacedJob

class

prefect.tasks.kubernetes.job.DeleteNamespacedJob

(job_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for deleting a namespaced job on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • job_name (str, optional): The name of a job to delete
  • namespace (str, optional): The Kubernetes namespace to delete this job from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.job.DeleteNamespacedJob.run

(job_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", delete_option_kwargs=None)[source]

Task run method.

Args:

  • job_name (str, optional): The name of a job to delete
  • namespace (str, optional): The Kubernetes namespace to delete this job in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • delete_option_kwargs (dict, optional): Optional keyword arguments to pass to the V1DeleteOptions object (e.g. {"propagation_policy": "...", "grace_period_seconds": "..."}.
Raises:
  • ValueError: if job_name is None



# ListNamespacedJob

class

prefect.tasks.kubernetes.job.ListNamespacedJob

(namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for listing namespaced jobs on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • namespace (str, optional): The Kubernetes namespace to list jobs from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"field_selector": "...", "label_selector": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.job.ListNamespacedJob.run

(namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • namespace (str, optional): The Kubernetes namespace to list jobs from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"field_selector": "...", "label_selector": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Returns:
  • V1JobList: a Kubernetes V1JobList of the jobs which are found



# PatchNamespacedJob

class

prefect.tasks.kubernetes.job.PatchNamespacedJob

(job_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for patching a namespaced job on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • job_name (str, optional): The name of a job to patch
  • body (dict, optional): A dictionary representation of a Kubernetes V1Job patch specification
  • namespace (str, optional): The Kubernetes namespace to patch this job in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.job.PatchNamespacedJob.run

(job_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • job_name (str, optional): The name of a job to patch
  • body (dict, optional): A dictionary representation of a Kubernetes V1Job patch specification
  • namespace (str, optional): The Kubernetes namespace to patch this job in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None
  • ValueError: if job_name is None



# ReadNamespacedJob

class

prefect.tasks.kubernetes.job.ReadNamespacedJob

(job_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for reading a namespaced job on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • job_name (str, optional): The name of a job to read
  • namespace (str, optional): The Kubernetes namespace to read this job from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "exact": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.job.ReadNamespacedJob.run

(job_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • job_name (str, optional): The name of a job to read
  • namespace (str, optional): The Kubernetes namespace to read this job in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "exact": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Returns:
  • V1Job: a Kubernetes V1Job matching the job that was found
Raises:
  • ValueError: if job_name is None



# ReplaceNamespacedJob

class

prefect.tasks.kubernetes.job.ReplaceNamespacedJob

(job_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for replacing a namespaced job on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • job_name (str, optional): The name of a job to replace
  • body (dict, optional): A dictionary representation of a Kubernetes V1Job specification
  • namespace (str, optional): The Kubernetes namespace to patch this job in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.job.ReplaceNamespacedJob.run

(job_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • job_name (str, optional): The name of a job to replace
  • body (dict, optional): A dictionary representation of a Kubernetes V1Job specification
  • namespace (str, optional): The Kubernetes namespace to patch this job in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None
  • ValueError: if job_name is None



# CreateNamespacedPod

class

prefect.tasks.kubernetes.pod.CreateNamespacedPod

(body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for creating a namespaced pod on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • body (dict, optional): A dictionary representation of a Kubernetes V1Pod specification
  • namespace (str, optional): The Kubernetes namespace to create this pod in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.pod.CreateNamespacedPod.run

(body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • body (dict, optional): A dictionary representation of a Kubernetes V1Pod specification
  • namespace (str, optional): The Kubernetes namespace to create this pod in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None



# DeleteNamespacedPod

class

prefect.tasks.kubernetes.pod.DeleteNamespacedPod

(pod_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for deleting a namespaced pod on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • pod_name (str, optional): The name of a pod to delete
  • namespace (str, optional): The Kubernetes namespace to delete this pod from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.pod.DeleteNamespacedPod.run

(pod_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", delete_option_kwargs=None)[source]

Task run method.

Args:

  • pod_name (str, optional): The name of a pod to delete
  • namespace (str, optional): The Kubernetes namespace to delete this pod in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • delete_option_kwargs (dict, optional): Optional keyword arguments to pass to the V1DeleteOptions object (e.g. {"propagation_policy": "...", "grace_period_seconds": "..."}.
Raises:
  • ValueError: if pod_name is None



# ListNamespacedPod

class

prefect.tasks.kubernetes.pod.ListNamespacedPod

(namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for listing namespaced pods on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • namespace (str, optional): The Kubernetes namespace to list pods from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"field_selector": "...", "label_selector": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.pod.ListNamespacedPod.run

(namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • namespace (str, optional): The Kubernetes namespace to list pods from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"field_selector": "...", "label_selector": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Returns:
  • V1PodList: a Kubernetes V1PodList of the pods which are found



# PatchNamespacedPod

class

prefect.tasks.kubernetes.pod.PatchNamespacedPod

(pod_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for patching a namespaced pod on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • pod_name (str, optional): The name of a pod to patch
  • body (dict, optional): A dictionary representation of a Kubernetes V1Pod patch specification
  • namespace (str, optional): The Kubernetes namespace to patch this pod in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.pod.PatchNamespacedPod.run

(pod_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • pod_name (str, optional): The name of a pod to patch
  • body (dict, optional): A dictionary representation of a Kubernetes V1Pod patch specification
  • namespace (str, optional): The Kubernetes namespace to patch this pod in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None
  • ValueError: if pod_name is None



# ReadNamespacedPod

class

prefect.tasks.kubernetes.pod.ReadNamespacedPod

(pod_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for reading a namespaced pod on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • pod_name (str, optional): The name of a pod to read
  • namespace (str, optional): The Kubernetes namespace to read this pod from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "exact": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.pod.ReadNamespacedPod.run

(pod_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • pod_name (str, optional): The name of a pod to read
  • namespace (str, optional): The Kubernetes namespace to read this pod in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "exact": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Returns:
  • V1Pod: a Kubernetes V1Pod matching the pod that was found
Raises:
  • ValueError: if pod_name is None



# ReplaceNamespacedPod

class

prefect.tasks.kubernetes.pod.ReplaceNamespacedPod

(pod_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for replacing a namespaced pod on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • pod_name (str, optional): The name of a pod to replace
  • body (dict, optional): A dictionary representation of a Kubernetes V1Pod specification
  • namespace (str, optional): The Kubernetes namespace to patch this pod in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.pod.ReplaceNamespacedPod.run

(pod_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • pod_name (str, optional): The name of a pod to replace
  • body (dict, optional): A dictionary representation of a Kubernetes V1Pod specification
  • namespace (str, optional): The Kubernetes namespace to patch this pod in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None
  • ValueError: if pod_name is None



# CreateNamespacedService

class

prefect.tasks.kubernetes.service.CreateNamespacedService

(body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for creating a namespaced service on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Service in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • body (dict, optional): A dictionary representation of a Kubernetes V1Service specification
  • namespace (str, optional): The Kubernetes namespace to create this service in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.service.CreateNamespacedService.run

(body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • body (dict, optional): A dictionary representation of a Kubernetes V1Service specification
  • namespace (str, optional): The Kubernetes namespace to create this service in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None



# DeleteNamespacedService

class

prefect.tasks.kubernetes.service.DeleteNamespacedService

(service_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for deleting a namespaced service on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Service in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • service_name (str, optional): The name of a service to delete
  • namespace (str, optional): The Kubernetes namespace to delete this service from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.service.DeleteNamespacedService.run

(service_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", delete_option_kwargs=None)[source]

Task run method.

Args:

  • service_name (str, optional): The name of a service to delete
  • namespace (str, optional): The Kubernetes namespace to delete this service in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • delete_option_kwargs (dict, optional): Optional keyword arguments to pass to the V1DeleteOptions object (e.g. {"propagation_policy": "...", "grace_period_seconds": "..."}.
Raises:
  • ValueError: if service_name is None



# ListNamespacedService

class

prefect.tasks.kubernetes.service.ListNamespacedService

(namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for listing namespaced services on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Service in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • namespace (str, optional): The Kubernetes namespace to list services from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"field_selector": "...", "label_selector": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.service.ListNamespacedService.run

(namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • namespace (str, optional): The Kubernetes namespace to list services from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"field_selector": "...", "label_selector": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Returns:
  • V1ServiceList: a Kubernetes V1ServiceList of the services which are found



# PatchNamespacedService

class

prefect.tasks.kubernetes.service.PatchNamespacedService

(service_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for patching a namespaced service on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Service in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • service_name (str, optional): The name of a service to patch
  • body (dict, optional): A dictionary representation of a Kubernetes V1Service patch specification
  • namespace (str, optional): The Kubernetes namespace to patch this service in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.service.PatchNamespacedService.run

(service_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • service_name (str, optional): The name of a service to patch
  • body (dict, optional): A dictionary representation of a Kubernetes V1Service patch specification
  • namespace (str, optional): The Kubernetes namespace to patch this service in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None
  • ValueError: if service_name is None



# ReadNamespacedService

class

prefect.tasks.kubernetes.service.ReadNamespacedService

(service_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for reading a namespaced service on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Service in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The argument kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide kube_kwargs = {"info": "here"} at instantiation and then provide kube_kwargs = {"more": "info"} at run time which will make kube_kwargs = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • service_name (str, optional): The name of a service to read
  • namespace (str, optional): The Kubernetes namespace to read this service from, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "exact": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.service.ReadNamespacedService.run

(service_name=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • service_name (str, optional): The name of a service to read
  • namespace (str, optional): The Kubernetes namespace to read this service in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "exact": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Returns:
  • V1Service: a Kubernetes V1Service matching the service that was found
Raises:
  • ValueError: if service_name is None



# ReplaceNamespacedService

class

prefect.tasks.kubernetes.service.ReplaceNamespacedService

(service_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]

Task for replacing a namespaced service on Kubernetes. Note that all initialization arguments can optionally be provided or overwritten at runtime.

This task will attempt to connect to a Kubernetes cluster in three steps with the first successful connection attempt becoming the mode of communication with a cluster.

  1. Attempt to use a Prefect Secret that contains a Kubernetes API Key. If kubernetes_api_key_secret = None then it will attempt the next two connection mathods. By default the value is KUBERNETES_API_KEY so providing None acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Service in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file

The arguments body and kube_kwargs will perform an in-place update when the task is run. This means that it is possible to provide body = {"info": "here"} at instantiation and then provide body = {"more": "info"} at run time which will make body = {"info": "here", "more": "info"}. Note: Keys present in both instantiation and runtime will be replaced with the runtime value.

Args:

  • service_name (str, optional): The name of a service to replace
  • body (dict, optional): A dictionary representation of a Kubernetes V1Service specification
  • namespace (str, optional): The Kubernetes namespace to patch this service in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.kubernetes.service.ReplaceNamespacedService.run

(service_name=None, body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source]

Task run method.

Args:

  • service_name (str, optional): The name of a service to replace
  • body (dict, optional): A dictionary representation of a Kubernetes V1Service specification
  • namespace (str, optional): The Kubernetes namespace to patch this service in, defaults to the default namespace
  • kube_kwargs (dict, optional): Optional extra keyword arguments to pass to the Kubernetes API (e.g. {"pretty": "...", "dry_run": "..."})
  • kubernetes_api_key_secret (str, optional): the name of the Prefect Secret which stored your Kubernetes API Key; this Secret must be a string and in BearerToken format
Raises:
  • ValueError: if body is None
  • ValueError: if service_name is None



This documentation was auto-generated from commit n/a
on June 17, 2020 at 17:27 UTC