diff --git a/README.md b/README.md index 2f1b07a..e761dbe 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ More than one smarter-device-manager can be used in a single node if required if *Enabling access* -A few examples of yaml files are provided that enables the smarter-device-manager to be deployed in a node. The file smarter-device-management-pod.yaml deploys a single pod on a node, it is useful for testing. The file smarter-device-manager.yaml provides aq deamonSet configuration that enables pods to be deployed in any node that contains the "smarter-device-manager=enabled" label. The following command inserts the daemonSet in Kubernetes. +A few examples of yaml files are provided that enables the smarter-device-manager to be deployed in a node. The file smarter-device-management-pod-<>.yaml deploys a single pod on a node, it is useful for testing. The file smarter-device-manager-<>.yaml provides aq deamonSet configuration that enables pods to be deployed in any node that contains the "smarter-device-manager=enabled" label. The following command inserts the daemonSet in Kubernetes. K3s and K8s put the unix sockets for the device plugin in different directories on the node so the *-k8s.yaml files should be used on Kubernetes and the *-k3s.yaml should be used on K3s. ``` kubectl apply -f smarter-device-manager.yaml ``` diff --git a/smarter-device-management-pod-k3s.yaml b/smarter-device-management-pod-k3s.yaml new file mode 100644 index 0000000..acbd566 --- /dev/null +++ b/smarter-device-management-pod-k3s.yaml @@ -0,0 +1,43 @@ +apiVersion: v1 +kind: Pod +metadata: + name: smarter-device-management + namespace: default +spec: + # 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. + # See https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/ + priorityClassName: "system-node-critical" + hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet + hostname: smarter-device-management + nodeName: + containers: + - name: smarter-device-manager + image: registry.gitlab.com/arm-research/smarter/smarter-device-manager/smarter-device-manager:20191204204613 + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + resources: + limits: + cpu: 100m + memory: 10Mi + requests: + cpu: 10m + memory: 10Mi + volumeMounts: + - name: device-plugin + mountPath: /var/lib/kubelet/device-plugins + - name: dev-dir + mountPath: /dev + volumes: + - name: device-plugin + hostPath: + path: /var/lib/rancher/k3s/agent/kubelet/device-plugins + - name: dev-dir + hostPath: + path: /dev + terminationGracePeriodSeconds: 30 diff --git a/smarter-device-management-pod.yaml b/smarter-device-management-pod-k8s.yaml similarity index 100% rename from smarter-device-management-pod.yaml rename to smarter-device-management-pod-k8s.yaml diff --git a/smarter-device-manager-k3s.yaml b/smarter-device-manager-k3s.yaml new file mode 100644 index 0000000..29e836a --- /dev/null +++ b/smarter-device-manager-k3s.yaml @@ -0,0 +1,64 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: < Replace with the namespace to use > + labels: + name: < Replace with the namespace to use > +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: smarter-device-manager + namespace: < Replace with the namespace to use > + labels: + name: smarter-device-manager + role: agent +spec: + selector: + matchLabels: + name: smarter-device-manager + updateStrategy: + type: RollingUpdate + template: + metadata: + labels: + name: smarter-device-manager + annotations: + node.kubernetes.io/bootstrap-checkpoint: "true" + spec: + nodeSelector: + smarter-device-manager : enabled + priorityClassName: "system-node-critical" + hostname: smarter-device-management + hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet + imagePullSecrets: + - name: k8sedgeregcred + containers: + - name: smarter-device-manager + image: registry.gitlab.com/arm-research/smarter/smarter-device-manager/smarter-device-manager:20191204204613 + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + resources: + limits: + cpu: 100m + memory: 15Mi + requests: + cpu: 10m + memory: 15Mi + volumeMounts: + - name: device-plugin + mountPath: /var/lib/kubelet/device-plugins + - name: dev-dir + mountPath: /dev + volumes: + - name: device-plugin + hostPath: + path: /var/lib/rancher/k3s/agent/kubelet/device-plugins + - name: dev-dir + hostPath: + path: /dev + terminationGracePeriodSeconds: 30 diff --git a/smarter-device-manager.yaml b/smarter-device-manager-k8s.yaml similarity index 100% rename from smarter-device-manager.yaml rename to smarter-device-manager-k8s.yaml