Nuno Silva
Nuno Silva

Reputation: 126

prefect kubernetes aks (azure) virtual nodes

To run prefect jobs in azure kubernetes (aks) virtual nodes, besides adding the recommended nodeSelector/tolerations:

"nodeSelector": {
    "kubernetes.io/role": "agent",
    "beta.kubernetes.io/os": "linux",
    "type": "virtual-kubelet",
},
"tolerations": [
    {"key": "virtual-kubelet.io/provider", "operator": "Exists"},
    {"key": "azure.com/aci", "effect": "NoSchedule"},
],

container creation fails with:

Warning   ProviderCreateFailed   pod/prefect-job-XXXXX-XXXXX   ACI does not support providing args without specifying the command. Please supply both command and args to the pod spec.

The different command options stated in https://linen.prefect.io/t/48087/topic do not work.

How to solve it?

Upvotes: 0

Views: 173

Answers (1)

Nuno Silva
Nuno Silva

Reputation: 126

command": ["tini", "-g", "--"],

solves the issue and allows prefect jobs to run in aks virtual nodes.

Here an example of a working job_template:

{
    "apiVersion": "batch/v1",
    "kind": "Job",
    "spec": {
        "template": {
            "spec": {
                "containers": [
                    {
                        "name": "flow",
                        "command": ["tini", "-g", "--"],
                    }
                ],
                "nodeSelector": {
                    "kubernetes.io/role": "agent",
                    "beta.kubernetes.io/os": "linux",
                    "type": "virtual-kubelet",
                },
                "tolerations": [
                    {"key": "virtual-kubelet.io/provider", "operator": "Exists"},
                    {"key": "azure.com/aci", "effect": "NoSchedule"},
                ],
                "imagePullSecrets": [
                    {"name": "regcred"},
                ],
            },
        }
    },
}

Upvotes: 1

Related Questions