YSF
06/26/2023, 6:34 PMjob_variables
to override the cpu and memory requestMarvin
06/26/2023, 6:35 PMdeployments.yaml
file for an AKS worker that uses job_variables
to override the CPU and memory request:
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-aks-worker
spec:
replicas: 1
selector:
matchLabels:
app: my-aks-worker
template:
metadata:
labels:
app: my-aks-worker
spec:
containers:
- name: my-aks-worker
image: prefecthq/prefect:latest
env:
- name: PREFECT__CLOUD__AGENT__LABELS
value: "aks"
- name: PREFECT__CLOUD__AGENT__TOKEN
valueFrom:
secretKeyRef:
name: prefect-api-token
key: token
resources:
requests:
memory: "{{ job_variables.memory_request }}Mi"
cpu: "{{ job_variables.cpu_request }}m"
In this example, the job_variables.memory_request
and job_variables.cpu_request
are used to set the memory and CPU requests for the AKS worker container. Make sure to replace the prefecthq/prefect:latest
image with the appropriate Prefect image for your use case.
Remember to replace the placeholders {{ job_variables.memory_request }}
and {{ job_variables.cpu_request }}
with the actual values you want to use when deploying your AKS worker.
I hope this helps you in your quest for YAML perfection. Good luck, human!YSF
06/26/2023, 6:41 PMdeployments:
- name: aks-test-sp
entrypoint: .\workflow\flow_demo.py:aks_demo_flow
work_pool:
name: aks-worker
job_variables:
cpu_request: "4"
cpu_limit: "8"
Marvin
06/26/2023, 6:42 PMdeployments.yaml
file like this:
yaml
deployments:
- name: aks-test-sp
entrypoint: .\workflow\flow_demo.py:aks_demo_flow
work_pool:
name: aks-worker
job_variables:
cpu_request: "4"
cpu_limit: "8"
memory_request: "2Gi"
memory_limit: "4Gi"
Now, let's update the AKS worker deployment to use these `job_variables`:
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-aks-worker
spec:
replicas: 1
selector:
matchLabels:
app: my-aks-worker
template:
metadata:
labels:
app: my-aks-worker
spec:
containers:
- name: my-aks-worker
image: prefecthq/prefect:latest
env:
- name: PREFECT__CLOUD__AGENT__LABELS
value: "aks"
- name: PREFECT__CLOUD__AGENT__TOKEN
valueFrom:
secretKeyRef:
name: prefect-api-token
key: token
resources:
requests:
memory: "{{ job_variables.memory_request }}"
cpu: "{{ job_variables.cpu_request }}"
limits:
memory: "{{ job_variables.memory_limit }}"
cpu: "{{ job_variables.cpu_limit }}"
In this example, the job_variables
from your deployments.yaml
file are used to set the memory and CPU requests and limits for the AKS worker container. Make sure to replace the prefecthq/prefect:latest
image with the appropriate Prefect image for your use case.
Keep in mind that you'll need to replace the placeholders {{ job_variables.memory_request }}
, {{ job_variables.memory_limit }}
, {{ job_variables.cpu_request }}
, and {{ job_variables.cpu_limit }}
with the actual values from your deployments.yaml
file when deploying your AKS worker.
I hope this clears up the YAML fog. Good luck with your deployment, human!YSF
06/26/2023, 7:04 PMYSF
06/26/2023, 9:14 PMMarvin
06/26/2023, 9:15 PMcustom-nodepool
, you can label its nodes with nodepool: custom-nodepool
.
Next, update your AKS worker deployment to include the nodeSelector
field:
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-aks-worker
spec:
replicas: 1
selector:
matchLabels:
app: my-aks-worker
template:
metadata:
labels:
app: my-aks-worker
spec:
containers:
- name: my-aks-worker
image: prefecthq/prefect:latest
env:
- name: PREFECT__CLOUD__AGENT__LABELS
value: "aks"
- name: PREFECT__CLOUD__AGENT__TOKEN
valueFrom:
secretKeyRef:
name: prefect-api-token
key: token
resources:
requests:
memory: "{{ job_variables.memory_request }}"
cpu: "{{ job_variables.cpu_request }}"
limits:
memory: "{{ job_variables.memory_limit }}"
cpu: "{{ job_variables.cpu_limit }}"
nodeSelector:
nodepool: custom-nodepool
In this example, the nodeSelector
field is set to match nodes with the label nodepool: custom-nodepool
. This will ensure that your deployment runs on nodes within the custom-nodepool
node pool.
Remember to adjust the other parts of the YAML file according to your specific requirements, such as the Prefect image and resource requests and limits.
And there you have it, another YAML mystery solved. Good luck with your node pool adventures, human!YSF
06/26/2023, 9:17 PMdeployments:
- name: aks-test-sp
entrypoint: .\workflow\flow_demo.py:aks_demo_flow
work_pool:
name: aks-worker
job_variables:
cpu_request: "4"
cpu_limit: "8"
memory_request: "2Gi"
memory_limit: "4Gi"
Christopher Boyd
06/26/2023, 9:31 PMChristopher Boyd
06/26/2023, 9:31 PMChristopher Boyd
06/26/2023, 9:32 PMChristopher Boyd
06/26/2023, 9:32 PMChristopher Boyd
06/26/2023, 9:33 PMChristopher Boyd
06/26/2023, 9:34 PMChristopher Boyd
06/26/2023, 9:34 PMChristopher Boyd
06/26/2023, 9:35 PMChristopher Boyd
06/26/2023, 9:36 PMYSF
06/26/2023, 9:36 PMYSF
06/26/2023, 9:37 PMChristopher Boyd
06/26/2023, 9:38 PMChristopher Boyd
06/26/2023, 9:38 PM