Kubernetes:挂载:附加 AWS EBS 卷时不存在特殊设备 [英] Kubernetes: mount: special device does not exist when attaching AWS EBS volume
问题描述
亲爱的 Kubernetes 大师!
dear Kubernetes guru's!
我使用'contrib' Ansible playbook (https://github.com/kubernetes/contrib/tree/master/ansible).
I have spinned kube 1.4.1 cluster on manually created AWS hosts using 'contrib' Ansible playbook (https://github.com/kubernetes/contrib/tree/master/ansible).
我的问题是 Kube 没有将 EBS 驱动器附加到 Minion 主机.如果我将 pod 定义如下:
My problem is that Kube doesn't attach EBS drives to minion hosts. If I define the pod as follows:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kafka1
spec:
replicas: 1
template:
spec:
containers:
- name: kafka1
image: daniilyar/kafka
ports:
- containerPort: 9092
name: clientconnct
protocol: TCP
volumeMounts:
- mountPath: /kafka
name: storage
volumes:
- name: storage
awsElasticBlockStore:
volumeID: vol-56676d83
fsType: ext4
我在 kubelet.log 中收到以下错误:
I get the following error in kubelet.log:
Mounting arguments: /var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/vol-56676d83 /var/lib/kubelet/pods/db213783-9477-11e6-8aa9-12f3d1cdf81a/volumes/kubernetes.io~aws-ebs/storage [bind]
Output: mount: special device /var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/vol-56676d83 does not exist
EBS 卷在此期间一直处于可用"状态,因此我确信 Kube 不会将卷附加到主机,因此不会挂载 它.我 100% 确定这是 Kubernetes 本身的问题,而不是权限问题,因为我可以从这个 minion 中手动挂载相同的卷到这个 minion 就好了:
EBS volume keeps being in 'Available' state during that, so I am sure that Kube doesn't attach volume to host at all and so, doesn't mount it. I am 100% sure that this is a Kubernetes itself issue and not the permissioning issue because I can mount the same volume manually from within this minion to this minion just fine:
$ aws ec2 --region us-east-1 attach-volume --volume-id vol-56676d83 --instance-id $(wget -q -O - http://instance-data/latest/meta-data/instance-id) --device /dev/sdc
{
"AttachTime": "2016-10-18T15:02:41.672Z",
"InstanceId": "i-603cfb50",
"VolumeId": "vol-56676d83",
"State": "attaching",
"Device": "/dev/sdc"
}
谷歌搜索、黑客攻击和尝试旧的 K8 版本并没有帮助我解决这个问题.任何人都可以请我指出我还能做些什么来理解这个问题,以便我可以解决它?非常感谢任何帮助.
Googling, hacking and trying older K8 versions didn't help me to solve this. Could anyone please point me on what else could I do to understand the problem so I can fix it? Any help is greatly appreciated.
推荐答案
在 K8 Slack 频道没有人帮助我,所以在折腾了一天之后我自己找到了解决方案:
Nobody helped me at K8 Slack channels, so after a day of pulling my hair off I found the solution by myself:
通过'contrib' Ansible playbook (https://github.com/kubernetes/contrib/tree/master/ansible) 正确挂载 EBS 卷,除了 IAM 角色设置,您需要将 --cloud-provider=aws 标志添加到您的现有集群:所有 kubelets、apiserver 和控制器管理器.
To get the K8 cluster installed by 'contrib' Ansible playbook (https://github.com/kubernetes/contrib/tree/master/ansible) mounting EBS volumes properly, except for IAM roles setup, you need to add the --cloud-provider=aws flag to your existing cluster: all kubelets, the apiserver, and the controller manager.
如果没有 --cloud-provider=aws 标志,Kubernetes 会给你一个不友好的mount: special device xxx does not exist"错误而不是真正的原因.
Without --cloud-provider=aws flag Kubernetes will give you an unfriendly 'mount: special device xxx does not exist' error instead of real cause.
这篇关于Kubernetes:挂载:附加 AWS EBS 卷时不存在特殊设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!