I encountered some problems when I used kubernetes' Initializers to enable LXCFS.
ENV: Kernel 3.10, centos7.5, k8s1.11.3
After deploying lxcfs-initializer with daemonset,when i add the annotations: "initializer.kubernetes.io/lxcfs": "true"
in yaml, the container run successful.
However, without this annotation, when I try to create a deployment, it gives following error:
[root@master1 ~]# kubectl apply -f test.yaml
service/nginx-service created
Error from server (Timeout): error when creating "test.yaml": Timeout: request did not complete within allowed duration
Here, is my test.yaml
:
apiVersion: apps/v1
kind: Deployment
metadata:
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14
imagePullPolicy: Always
ports:
- name: service-port
containerPort: 80
resources:
requests:
memory: "250Mi"
cpu: "0.5"
limits:
memory: "500Mi"
cpu: "1"
volumeMounts:
- name: timezone
mountPath: /etc/localtime
restartPolicy: Always
volumes:
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
Also, lxcfs-initializer
is running,
[root@master1 ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
lxcfs-cn76r 1/1 Running 0 1h
lxcfs-initializer-647c5fb868-7mkfg 1/1 Running 0 1h
lxcfs-v75qt 1/1 Running 0 1h
lxcfs-x5jdl 1/1 Running 0 1h