k8s1.12以上版本设置LXCFS 发表于 2019-08-07 | 分类于 k8s | 浏览 次 安装依赖包1yum -y install fuse-devel fuse fuse-libs 使用k8s Daemonsets部署lxcfs123456789101112131415161718192021222324252627282930313233343536373839404142434445apiVersion: apps/v1beta2kind: DaemonSetmetadata: name: lxcfs namespace: default labels: app: lxcfsspec: selector: matchLabels: app: lxcfs template: metadata: labels: app: lxcfs spec: hostPID: true tolerations: - key: node-role.kubernetes.io/master effect: NoSchedule containers: - name: lxcfs image: registry.cn-hangzhou.aliyuncs.com/denverdino/lxcfs:3.0.4 imagePullPolicy: Always securityContext: privileged: true volumeMounts: - name: cgroup mountPath: /sys/fs/cgroup - name: lxcfs mountPath: /var/lib/lxcfs mountPropagation: Bidirectional - name: usr-local mountPath: /usr/local volumes: - name: cgroup hostPath: path: /sys/fs/cgroup - name: usr-local hostPath: path: /usr/local - name: lxcfs hostPath: path: /var/lib/lxcfs type: DirectoryOrCreate 例子1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768apiVersion: apps/v1kind: Deploymentmetadata: annotations: "initializer.kubernetes.io/lxcfs": "true" labels: app: web name: webspec: replicas: 1 selector: matchLabels: app: web template: metadata: labels: app: web spec: containers: - name: web image: httpd:2.4.32 volumeMounts: - name: cpuinfo mountPath: /proc/cpuinfo - name: meminfo mountPath: /proc/meminfo - name: diskstats mountPath: /proc/diskstats - name: stat mountPath: /proc/stat - name: swaps mountPath: /proc/swaps - name: uptime mountPath: /proc/uptime imagePullPolicy: Always resources: requests: memory: "1024Mi" cpu: "100m" limits: memory: "1024Mi" cpu: "100m" volumes: - name: cpuinfo hostPath: path: /var/lib/lxcfs/proc/cpuinfo type: File - name: meminfo hostPath: path: /var/lib/lxcfs/proc/meminfo type: File - name: diskstats hostPath: path: /var/lib/lxcfs/proc/diskstats type: File - name: stat hostPath: path: /var/lib/lxcfs/proc/stat type: File - name: swaps hostPath: path: /var/lib/lxcfs/proc/swaps type: File - name: uptime hostPath: path: /var/lib/lxcfs/proc/uptime type: File Donate 打赏 微信支付 支付宝 本文作者: Shu Yu 本文链接: https://shenshengkun.github.io/posts/9jdfjdja.html 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!