我正在尝试解决一个Error “ENOSPC: System Limit for Number of File Watchers Reached”
问题;这个问题通常通过在主机环境中通过sysctl
增加fs.inotify.max_user_watches
值来解决。此外,我不确定部分问题是否与使用"Spot“节点有关。
不幸的是,我所有设置或覆盖此值的尝试都失败了。或者是由于缺乏权限:例如,/proc/sys/fs/inotify/max_user_watches: Read-only file system
当试图配置GKE节点本身时,linuxConfig.sysctl
选项似乎不支持fs.inotify.max_user_watches
。
节点配置: pool.yaml
kubeletConfig: {}
linuxConfig:
sysctl:
fs.inotify.max_user_watches: '1048576'
~ gcloud container node-pools update POOL_NAME \
--cluster=CLUSTER_NAME \
--system-config-from-file=pool.yaml
ERROR: (gcloud.container.node-pools.update)
ResponseError: code=400, message=Unsupported kernel parameter fs.inotify.max_user_watches.
任何帮助,专门为GKE,将不胜感激!
发布于 2022-07-12 00:50:08
我找到了这个答案,它使用一个DaemonSet来修改所有节点。How to change the file-system watcher limit in Kubernetes (fs.inotify.max_user_watches)
node-setup-daemon-set.yaml
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
那就跑
k apply -f node-setup-daemon-set.yaml
注意:原始线程提到了安全问题..。
https://stackoverflow.com/questions/72945814
复制相似问题