/lxcfs-webhook

Deploy FUSE filesystem for LXC

Primary LanguageGoApache License 2.0Apache-2.0

lxcfs-webhook

lxcfs docker publish License FOSSA Status GitHub release (latest by date including pre-releases) Last Commit Go Report Card Go Reference

Automatically deploy LXCFS while mounted to the container

设计

https://kubeservice.cn/2021/04/27/k8s-lxcfs-overview/

动机

Pod 容器内资源可见性:让Pod的资源视角真实、准确

是否有个发现:Pod中限定了CPUMEM等资源大小,然而登入的POD中查询资源,却还是Node总的资源大小?

对于业务上云, java(识别内存资源开辟大小)、golang(识别CPU个数开启runtime线程个数) 等语言,在OOMGC方面的问题,有时常发生的原因

利用lxcfs将容器中读取出来的CPUMEMdiskswaps的信息是宿主机的信息,与容器实际分配和限制的资源量相同。 解决低层通过os.syscall获得的资源信息一致

依赖

  • Kubernetes: >= 1.16.0
  • cert-manager (v1.2+) is installed.
  • helm v3 is installed.

部署

  1. 创建webhook证书
kubectl apply -f ./hack/deployment/certs/ .
  1. 创建lxcfs daemonset.yaml
kubectl apply -f ./hack/deployment/lxcfs/ .
  1. 创建webhook
kubectl apply -f ./hack/deployment/webhook/ .

使用

设置

对需要namespaces 添加 webhook label

kubectl label namespace default lxcfs-admission-webhook=enabled

验证

kubectl apply -f ./hack/examples/httpd-test.yaml

问题一

在高版本centos中:

error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

解决方式:

sudo ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5

问题二

Kubernetes LXCFS故障恢复后,对现有Pod 进行 remount 操作

License

FOSSA Status