Hey guys, quick Q. Just wondering if anybody knew ...
# prefect-community
t
Hey guys, quick Q. Just wondering if anybody knew how stable the deployment YAML for agents would be going forward in Prefect 2.0. I know there were some changes in the past few weeks, but was wondering how often, if ever, the deployment YAML for agents will change in the future as we are planning to put our deployment YAMLs for agents in source control yet we would like to avoid having to manually reconfigure things if they change between updates. Any assistance in the matter would be greatly appreciated
1
c
Hi Tommy, Do you mean the deployment yaml for the kubernetes agents to deploy, or the deployment for the flow (via
prefect deployment build
)?
a
Boyd, I'm pretty sure Tommy meant the YAML for the agent @Tommy Nam the Kubernetes manifest for deploying an agent is just a template - you can fully customize it to your needs as we speak, I'm working on an example for AWS EKS, which looks as follows:
Copy code
apiVersion: apps/v1
kind: Deployment
metadata:
  name: agent
  namespace: $NAMESPACE_ENV
spec:
  selector:
    matchLabels:
      app: agent
  replicas: 1
  template:
    metadata:
      labels:
        app: agent
    spec:
      containers:
        - name: agent
          image: your_image
          command: ["prefect", "agent", "start", "-q", "QUEUE_NAME"]
          imagePullPolicy: "IfNotPresent"
          env:
            - name: PREFECT_API_URL
              valueFrom:
                secretKeyRef:
                  name: $K8_SECRET_NAME
                  key: api-url
            - name: PREFECT_API_KEY
              valueFrom:
                secretKeyRef:
                  name: $K8_SECRET_NAME
                  key: api-key
---
apiVersion: <http://rbac.authorization.k8s.io/v1|rbac.authorization.k8s.io/v1>
kind: Role
metadata:
  name: agent
  namespace: $NAMESPACE_ENV
rules:
  - apiGroups: [""]
    resources: ["pods", "pods/log", "pods/status"]
    verbs: ["get", "watch", "list"]
  - apiGroups: ["batch"]
    resources: ["jobs"]
    verbs: [ "get", "list", "watch", "create", "update", "patch", "delete" ]
---
apiVersion: <http://rbac.authorization.k8s.io/v1|rbac.authorization.k8s.io/v1>
kind: RoleBinding
metadata:
  name: agent
  namespace: $NAMESPACE_ENV
subjects:
  - kind: ServiceAccount
    name: default
    namespace: $NAMESPACE_ENV
roleRef:
  kind: Role
  name: agent
  apiGroup: <http://rbac.authorization.k8s.io|rbac.authorization.k8s.io>
you can use the same structure and you can use that for all future versions since permissions and other Kubernetes objects created here etc shouldn't change