Kubernetes:安装:附加AWS EBS卷时不存在特殊设备 [英] Kubernetes: mount: special device does not exist when attaching AWS EBS volume
问题描述
亲爱的Kubernetes大师!
dear Kubernetes guru's!
我已经使用 contrib Ansible剧本在手动创建的AWS主机上旋转了kube 1.4.1集群( 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驱动器连接到奴隶主机。如果我按如下方式定义容器:
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本身的问题,而不是许可问题,因为我可以从这个奴隶中手动安装相同的卷到这个奴隶就好了:
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"
}
使用Google搜索,修改和尝试较早的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剧本( https://github.com/kubernetes/contrib/tree/master/ansible )正确安装EBS卷,除了IAM角色设置外,您需要添加-cloud-provider = aws 标志标记到您现有的集群:所有kubelet,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会给您一个不友好的装载:特殊设备xxx不存在错误,而不是真正的原因。
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屋!