使用kubernetes的Initializers启用LXCFS时遇到了一些问题。
ENV:内核3.10,centos7.5,k8s1.11.3
在使用守护程序部署lxcfs-initializer之后,当我在yaml中添加注释:"initializer.kubernetes.io/lxcfs": "true"
时,容器运行成功。
但是,如果没有此注释,当我尝试创建部署时,会出现以下错误:
[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
这是我的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
此外,lxcfs-initializer
正在运行,
[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