我试图在Rackspace中设置Kubernetes集群,我理解为了获得持久的卷支持,我需要使用Cinder(Rackspace支持的Openstack)。
按照Cloud Provider Integrations setup指南,我已按以下方式设置/etc/kubernetes/cloud-config
[Global]
username=cinder
password=********
auth-url=https://identity.api.rackspacecloud.com/v2.0
tenant-name=1234567
region=LON
我已将以下内容添加到/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
--cloud-provider=openstack --cloud-config=/etc/kubernetes/cloud-config
然后我运行kubeadm init --config=kubeadm.conf
,其中kubeadm.conf是:
kind: MasterConfiguration
apiVersion: kubeadm.k8s.io/v1alpha1
cloudProvider: openstack
pod-network-cidr: 10.244.0.0/16
无法等待kubelet启动。我将kubelet错误追溯到以下内容:
07:24:51.407692 21412 feature_gate.go:156] feature gates: map[]
07:24:51.407790 21412 controller.go:114] kubelet config controller: starting controller
07:24:51.407849 21412 controller.go:118] kubelet config controller: validating combination of defaults and flags
07:24:51.413973 21412 mount_linux.go:168] Detected OS with systemd
07:24:51.414065 21412 client.go:75] Connecting to docker on unix:///var/run/docker.sock
07:24:51.414137 21412 client.go:95] Start docker client with request timeout=2m0s
07:24:51.415471 21412 cni.go:196] Unable to update cni config: No networks found in /etc/cni/net.d
07:24:51.437924 21412 iptables.go:564] couldn't get iptables-restore version; assuming it doesn't support --wait
07:24:51.440245 21412 feature_gate.go:156] feature gates: map[]
07:24:52.066765 21412 server.go:301] Successfully initialized cloud provider: "openstack" from the config file: "/etc/kubernetes/cloud-config"
07:24:52.066984 21412 openstack_instances.go:39] openstack.Instances() called
07:24:52.067048 21412 openstack_instances.go:46] Claiming to support Instances
07:24:52.070870 21412 metadata.go:84] Unable to run blkid: exit status 2
07:24:52.070993 21412 metadata.go:124] Attempting to fetch metadata from http://169.254.169.254/openstack/2012-08-10/meta_data.json
07:25:22.071444 21412 metadata.go:127] Cannot read http://169.254.169.254/openstack/2012-08-10/meta_data.json: Get http://169.254.169.254/openstack/2012-08-10/meta_data.json: dial tcp 169.254.169.254:80: i/o timeout
error: failed to run Kubelet: error fetching current node name from cloud provider: Get http://169.254.169.254/openstack/2012-08-10/meta_data.json: dial tcp 169.254.169.254:80: i/o timeout
如何进一步调试?我真的不明白IP地址169.254.169.254如何在此请求中运行。
现在我无法判断我是否有Kubernetes问题或Rackspace问题。
答案 0 :(得分:0)
答案是Rackspace Cloud不使用Openstack元数据服务。相反,它使用带有config-drive的cloud-init - 一个在启动时连接的只读块设备(虚拟CD-ROM)。
配置驱动器包含cloud-init数据。示例https://developer.rackspace.com/blog/using-cloud-init-with-rackspace-cloud/
有趣的是,似乎大多数使用Kubernetes的Rackspace客户都使用支持cloud-config和Openstack配置驱动器的CoreOS VM。当K8在安装了驱动器的计算机上运行时,它会尝试从那里获取元数据。
答案 1 :(得分:0)
根据此链接,您需要将您的cloud-config文件放在/ etc / kubernetes / pki中。我尝试过这种方法并且有效。