Skip to content

Instantly share code, notes, and snippets.

@innovia
Created May 6, 2018 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save innovia/8c8b7acd2945ec219bda3e9a8a9cc8e9 to your computer and use it in GitHub Desktop.
Save innovia/8c8b7acd2945ec219bda3e9a8a9cc8e9 to your computer and use it in GitHub Desktop.
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: nvidia-device-plugin-daemonset
namespace: kube-system
spec:
template:
metadata:
# Mark this pod as a critical add-on; when enabled, the critical add-on scheduler
# reserves resources for critical add-on pods so that they can be rescheduled after
# a failure. This annotation works in tandem with the toleration below.
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ""
labels:
name: nvidia-device-plugin-ds
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: beta.kubernetes.io/instance-type
operator: In
values:
- "p3.2xlarge"
- "p2.xlarge"
tolerations:
# Allow this pod to be rescheduled while the node is in "critical add-ons only" mode.
# This, along with the annotation above marks this pod as a critical add-on.
- key: CriticalAddonsOnly
operator: Exists
- key: "beta.kubernetes.io/instance-type"
operator: "Equal"
value: "p3.2xlarge"
effect: "NoSchedule"
- key: "beta.kubernetes.io/instance-type"
operator: "Equal"
value: "p2.xlarge"
effect: "NoSchedule"
containers:
- image: nvidia/k8s-device-plugin:1.10
name: nvidia-device-plugin-ctr
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
volumeMounts:
- name: device-plugin
mountPath: /var/lib/kubelet/device-plugins
volumes:
- name: device-plugin
hostPath:
path: /var/lib/kubelet/device-plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment