Compute configuration options for Kubernetes
This page provides an example of a compute config for Kubernetes. Anyscale applies compute configs as a strategic merge patch to the Pod specifications generated by Anyscale before sending them to the Kubernetes API.
For a general overview of compute configs, see Compute configuration on Anyscale.
For configuration settings applicable to all Anyscale clouds, see Advanced settings for compute configs on Anyscale.
Node-specific configurations override any cluster-wide configurations for that node type. For a full reference on configuring these properties, see the official Kubernetes documentation.
Example Kubernetes compute configuration
The following is an example of compute configuration options for Anyscale on Kubernetes:
- Anyscale console
- Anyscale CLI
{
"metadata": {
// Add a new label.
"labels": {"new-label": "example-value"},
// Add a new annotation.
"annotations": {"new-annotation": "example-value"}
},
"spec": {
// Add a node selector.
"nodeSelector": {"disktype": "ssd"},
"tolerations": [{
"effect": "NoSchedule",
"key": "dedicated",
"value": "example-anyscale"
}]
"containers": [{
"name": "ray",
// Enable privileged container in order to use Ray image_uri runtime env to run nested worker container via podman.
"securityContext": {
"privileged": true
},
// Add a PersistentVolumeClaim to the Ray container.
"volumeMounts": [{
"name": "pvc-volume",
"mountPath": "/mnt/pvc-data"
}]
},{
// Add a sidecar for exporting logs/metrics.
"name": "monitoring-sidecar",
"image": "timberio/vector:latest",
"ports": [{
"containerPort": 9000
}],
"volumeMounts": [{
"name": "vector-volume",
"mountPath": "/mnt/vector-data"
}]
}],
"volumes": [{
"name": "pvc-volume",
"persistentVolumeClaim": {
"claimName": "my-pvc"
}
},{
"name": "vector-volume",
"emptyDir": {}
}]
}
}
compute_config:
cloud: your_anyscale_cloud_name
head_node:
instance_type: 4CPU-16GB
worker_nodes:
- instance_type: 4CPU-16GB
min_nodes: 1
max_nodes: 10
advanced_instance_config:
metadata:
# Add a new label.
labels:
new-label: example-value
# Add a new annotation.
annotations:
new-annotation: example-value
spec:
# Add a node selector.
nodeSelector:
disktype: ssd
# Add tolerations.
tolerations:
- effect: NoSchedule
key: dedicated
value: example-anyscale
containers:
- name: ray
# Enable privileged container in order to use Ray image_uri runtime env to run nested worker container via podman.
securityContext:
privileged: true
# Add a PersistentVolumeClaim to the Ray container.
volumeMounts:
- name: pvc-volume
mountPath: /mnt/pvc-data
# Add a sidecar for exporting logs/metrics.
- name: monitoring-sidecar
image: timberio/vector:latest
ports:
- containerPort: 9000
volumeMounts:
- name: vector-volume
mountPath: /mnt/vector-data
volumes:
- name: pvc-volume
persistentVolumeClaim:
claimName: my-pvc
- name: vector-volume
emptyDir: {}