Hi all - I’ve been able to successfully deploy a f...
# prefect-community
l
Hi all - I’ve been able to successfully deploy a flow to prefect 2.0 using a kubernetes-job block and custom image that points my internal docker registry - however when I try to run the flow, I’m getting a k8s error from the agent:
Copy code
stern --tail 500 prefect-orion

"message":"The POST operation against Job.batch could not be completed at this time, please try again.","reason":"ServerTimeout"
My agent has the following role definition
Copy code
rules:
  - apiGroups: [""]
    resources: ["pods", "pods/log", "pods/status"]
    verbs: ["get", "watch", "list"]
  - apiGroups: ["batch"]
    resources: ["jobs"]
    verbs: [ "get", "list", "watch", "create", "update", "patch", "delete" ]
Heres my job template
Copy code
apiVersion: batch/v1
kind: Job
metadata:
  name: FLOWNAME-job
  labels:
    <http://app.kubernetes.io/name|app.kubernetes.io/name>: FLOWNAME
spec:
  template:
    spec:
      serviceAccountName: prefect-orion-agent
      restartPolicy: Never
      completions: 1
      parallelism: 1
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: "<http://kubernetes.io/arch|kubernetes.io/arch>"
                operator: In
                values: ["amd64"]
      containers:
        - name: prefect-job
          imagePullPolicy: IfNotPresent
          env:
            - name: SECRET_VALUE
              valueFrom:
                secretKeyRef:
                  name: prefect-orion-agent
                  key: SECRET_VALUE
            - name: CONFIGMAP_VALUE
              valueFrom:
                configMapKeyRef:
                  name: prefect-orion-agent
                  key: CONFIGMAP_VALUE
m
Hey @Leon Kozlowski Kubernetes is definitely not my forte but if you haven't already I'd check out this discourse article. It might help get you in the right direction https://discourse.prefect.io/t/creating-and-deploying-a-custom-kubernetes-infrastructure-block/1531
l
Thanks Mason, appreciate the callout, I did make one change relating to this, unfortunately it didn’t solve my issue, I will open a new thread tomorrow