Skip to content

Instantly share code, notes, and snippets.

@talss89
Created February 9, 2023 13:02
Show Gist options
  • Save talss89/5e8f05f8b7beb5d7290b1da0a4954487 to your computer and use it in GitHub Desktop.
Save talss89/5e8f05f8b7beb5d7290b1da0a4954487 to your computer and use it in GitHub Desktop.
Kubernetes - Increase file-watcher max-count on every node (for VSCode)
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: node-setup
namespace: kube-system
labels:
k8s-app: node-setup
spec:
selector:
matchLabels:
name: node-setup
template:
metadata:
labels:
name: node-setup
spec:
containers:
- name: node-setup
image: ubuntu
command: ["/bin/sh","-c"]
args: ["/script/node-setup.sh; while true; do echo Sleeping && sleep 3600; done"]
volumeMounts:
- name: node-setup-script
mountPath: /script
securityContext:
allowPrivilegeEscalation: true
privileged: true
volumes:
- name: node-setup-script
configMap:
name: node-setup-script
defaultMode: 0755
---
apiVersion: v1
kind: ConfigMap
metadata:
name: node-setup-script
namespace: kube-system
data:
node-setup.sh: |
#!/bin/bash
set -e
# change the file-watcher max-count on each node to 524288
# insert the new value into the system config
sysctl -w fs.inotify.max_user_watches=524288
# check that the new value was applied
cat /proc/sys/fs/inotify/max_user_watches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment