# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 specificationnamespace (str, optional)
: The Kubernetes namespace to create this deployment in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 deletenamespace (str, optional)
: The Kubernetes namespace to delete this deployment from, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 patchbody (dict, optional)
: A dictionary representation of a Kubernetes ExtensionsV1beta1Deployment patch specificationnamespace (str, optional)
: The Kubernetes namespace to patch this deployment in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 readnamespace (str, optional)
: The Kubernetes namespace to read this deployment from, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 replacebody (dict, optional)
: A dictionary representation of a Kubernetes ExtensionsV1beta1Deployment specificationnamespace (str, optional)
: The Kubernetes namespace to patch this deployment in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 specificationnamespace (str, optional)
: The Kubernetes namespace to create this job in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 deletenamespace (str, optional)
: The Kubernetes namespace to delete this job from, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 patchbody (dict, optional)
: A dictionary representation of a Kubernetes V1Job patch specificationnamespace (str, optional)
: The Kubernetes namespace to patch this job in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 readnamespace (str, optional)
: The Kubernetes namespace to read this job from, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 replacebody (dict, optional)
: A dictionary representation of a Kubernetes V1Job specificationnamespace (str, optional)
: The Kubernetes namespace to patch this job in, defaults to thedefault
namespacekube_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.
|
# RunNamespacedJob
class
prefect.tasks.kubernetes.job.RunNamespacedJob
(body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", job_status_poll_interval=5, log_level=None, delete_job_after_completion=True, **kwargs)[source]Task for running a namespaced job on Kubernetes. This task first creates a job on a Kubernetes cluster according to the specification given in the body, and then by default regularly checks its status at 5-second intervals. After the job is successfully completed, all resources by default are deleted: job and the corresponding pods. If job is in the failed status, resources will not be removed from the cluster so that user can check the logs on the cluster.
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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 specificationnamespace (str, optional)
: The Kubernetes namespace to create this job in, defaults to thedefault
namespacekube_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 formatjob_status_poll_interval (int, optional)
: The interval given in seconds indicating how often the Kubernetes API will be requested about the status of the job being performed, defaults to the5
secondslog_level (str, optional)
: Log level used when outputting logs from the job should be one ofdebug
,info
,warn
,error
, 'critical' orNone
to disable output completely. Defaults toNone
.delete_job_after_completion (bool, optional)
: boolean value determining whether resources related to a given job will be removed from the Kubernetes cluster after completion, defaults to theTrue
value**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.kubernetes.job.RunNamespacedJob.run (body=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", job_status_poll_interval=5, log_level=None, delete_job_after_completion=True)[source] |
Task run method.
|
# ConnectGetNamespacedPodExec
class
prefect.tasks.kubernetes.pod.ConnectGetNamespacedPodExec
(pod_name=None, container_name=None, exec_command=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]Task for running a command in 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 argumentkube_kwargs
will perform an in-place update when the task is run. This means that it is possible to providekube_kwargs = {"info": "here"}
at instantiation and then providekube_kwargs = {"more": "info"}
at run time which will makekube_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 in which the command is to be runcontainer_name (str, optional)
: The name of a container to use in the podexec_command (list, optional)
: the command to run in pod_namenamespace (str, optional)
: The Kubernetes namespace of the pod, defaults to thedefault
namespacekube_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.ConnectGetNamespacedPodExec.run (pod_name=None, container_name=None, exec_command=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source] |
Task run method.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 specificationnamespace (str, optional)
: The Kubernetes namespace to create this pod in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 deletenamespace (str, optional)
: The Kubernetes namespace to delete this pod from, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 patchbody (dict, optional)
: A dictionary representation of a Kubernetes V1Pod patch specificationnamespace (str, optional)
: The Kubernetes namespace to patch this pod in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 readnamespace (str, optional)
: The Kubernetes namespace to read this pod from, defaults to thedefault
namespacekube_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.
|
# ReadNamespacedPodLogs
class
prefect.tasks.kubernetes.pod.ReadNamespacedPodLogs
(pod_name=None, namespace="default", on_log_entry=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", **kwargs)[source]Task for reading logs from a namespaced pod on Kubernetes. Logs can be streamed by providing a on_log_entry
function which then will be called for each log line. If on_log_entry
= None
, the task returns all logs for the pod until that point.
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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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
Args:
pod_name (str, optional)
: The name of a pod to replacenamespace (str, optional)
: The Kubernetes namespace to patch this pod in, defaults to thedefault
namespaceon_log_entry (Callable, optional)
: If provided, will stream the pod logs calling the callback for every line (and the task returnsNone
). If not provided, the current pod logs will be returned immediately from the task.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.ReadNamespacedPodLogs.run (pod_name=None, namespace="default", on_log_entry=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source] |
Task run method.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 replacebody (dict, optional)
: A dictionary representation of a Kubernetes V1Pod specificationnamespace (str, optional)
: The Kubernetes namespace to patch this pod in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 specificationnamespace (str, optional)
: The Kubernetes namespace to create this service in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 deletenamespace (str, optional)
: The Kubernetes namespace to delete this service from, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 patchbody (dict, optional)
: A dictionary representation of a Kubernetes V1Service patch specificationnamespace (str, optional)
: The Kubernetes namespace to patch this service in, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 readnamespace (str, optional)
: The Kubernetes namespace to read this service from, defaults to thedefault
namespacekube_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.
|
# 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.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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 replacebody (dict, optional)
: A dictionary representation of a Kubernetes V1Service specificationnamespace (str, optional)
: The Kubernetes namespace to patch this service in, defaults to thedefault
namespacekube_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.
|
# KubernetesSecret
class
prefect.tasks.kubernetes.secrets.KubernetesSecret
(secret_name=None, secret_key=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY", cast=None, raise_if_missing=False, **kwargs)[source]Task for loading a Prefect secret from a kubernetes secret.
This task will read a secret from kubernetes, returning the decoded value associated with secret_key
. All initialization arguments can optionally be provided or overwritten at runtime.
Note that depending on cluster configuration, you may need to ensure you have the proper RBAC permissions to read the secret.
- 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 methods. By default the value isKUBERNETES_API_KEY
so providingNone
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
Args:
secret_name (string, optional)
: The name of the kubernetes secret objectsecret_key (string, optional)
: The key to look for in the kubernetes datanamespace (str, optional)
: The Kubernetes namespace to read the secret from, defaults to thedefault
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 formatcast (Callable[[Any], Any], optional)
: If provided, this will be called on the secret to transform it before returning. An example use might be passing injson.loads
to load values from stored JSON.raise_if_missing (bool)
: if True, an error will be raised if the secret is not found.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.kubernetes.secrets.KubernetesSecret.run (secret_name=None, secret_key=None, namespace="default", kube_kwargs=None, kubernetes_api_key_secret="KUBERNETES_API_KEY")[source] |
Returns the value of an kubenetes secret after applying an optional
|
This documentation was auto-generated from commit n/a
on July 1, 2021 at 18:35 UTC