Skip to content

Instantly share code, notes, and snippets.

@aojea
Created December 3, 2023 16:18
Show Gist options
  • Save aojea/ec4c0e72d437332939a62a44ca798328 to your computer and use it in GitHub Desktop.
Save aojea/ec4c0e72d437332939a62a44ca798328 to your computer and use it in GitHub Desktop.
Daemonset to reconcile nodes ethtool configuration
# See for more options https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: node-ethtool
namespace: kube-system
labels:
k8s-app: node-ethtool-config
spec:
selector:
matchLabels:
name: node-ethtool
template:
metadata:
labels:
name: node-ethtool
spec:
dnsPolicy: ClusterFirst
hostNetwork: true
restartPolicy: Always
# use tolerations to control where this daemonset should run are not
tolerations:
containers:
- name: node-ethtool
command: ["chroot", "/host", "sh", "-c"]
args: ["while true; do ethtool --offload eth0 rx off tx off; ethtool -K eth0 gso off ; sleep 30; done;"]
volumeMounts:
- name: host
mountPath: /host
securityContext:
capabilities:
add:
- NET_ADMIN
privileged: true
image: busybox:1.36
resources:
limits:
memory: 10Mi
requests:
cpu: 1m
memory: 1Mi
# it may be desirable to set a high priority class to ensure that a DaemonSet Pod
# preempts running Pods
# priorityClassName: important
# Don't do this, this is for testing, build a distroless image with the ethtool binary
volumes:
- name: host
hostPath:
path: /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment