Tommy Nam
08/30/2022, 2:22 AMChristopher Boyd
08/30/2022, 1:28 PMprefect deployment build
)?Anna Geller
08/30/2022, 4:15 PMapiVersion: 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