我有与此帖子类似的问题:kube-controller-manager don't start when using “cloud-provider=aws” with kubeadm,但这没有提供解决此问题的任何解决方案。以下是 kubernetes控制器管理器的日志统计信息。
I0705 17:59:05.941049 1 controllermanager.go:116] Version: v1.10.3
W0705 17:59:05.941983 1 authentication.go:55] Authentication is disabled
I0705 17:59:05.942004 1 insecure_serving.go:44] Serving insecurely on 127.0.0.1:10252
I0705 17:59:05.942450 1 leaderelection.go:175] attempting to acquire leader lease kube-system/kube-controller-manager...
I0705 17:59:22.823671 1 leaderelection.go:184] successfully acquired lease kube-system/kube-controller-manager
I0705 17:59:22.823945 1 event.go:218] Event(v1.ObjectReference{Kind:"Endpoints", Namespace:"kube-system", Name:"kube-controller-manager", UID:"ec7f1208-807c-11e8-bc66-0e594759e784", APIVersion:"v1", ResourceVersion:"289", FieldPath:""}): type: 'Normal' reason: 'LeaderElection' k8s_1bbcc7bc-807d-11e8-859d-0e594759e784 became leader
I0705 17:59:22.849017 1 aws.go:1026] Building AWS cloudprovider
I0705 17:59:22.849064 1 aws.go:988] Zone not specified in configuration file; querying AWS metadata service
F0705 17:59:22.851606 1 controllermanager.go:159] error building controller context: cloud provider could not be initialized: could not init cloud provider "aws": error finding instance i-07df027cffda674bc: "error listing AWS instances: \"NoCredentialProviders: no valid providers in chain. Deprecated.\\n\\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors\""
/etc/kubernetes/aws.conf
文件。
apiVersion: kubeadm.k8s.io/v1alpha1
kind: MasterConfiguration
cloudProvider: aws
kubernetesVersion: 1.10.3
/etc/kubernetes/cloud-config.conf
文件。
[Global]
KubernetesClusterTag=k8s
KubernetesClusterID=k8s
更改 EC2 实例标记,KEY = KubernetesCluster ,VALUE = k8s (在我的情况下)。
答案 0 :(得分:1)
修复cgroups
设置。
Environment="KUBELET_CGROUP_ARGS=--cgroup-driver=cgroupfs"
添加到/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
。sudo systemctl deamon-reload
sudo systemctl restart kubelet
安装weave net并在创建 kubernetes 集群之前启动。