简体   繁体   English

使用cloud-provider = aws的Kubernetes“无法注册节点”

[英]Kubernetes “Unable to register node” with cloud-provider=aws

I'm trying to run kubelet with --cloud-provider=aws flag but it fails with the following error: 我正在尝试使用--cloud-provider=aws标志运行kubelet ,但由于以下错误而失败:

kubelet_node_status.go:107] Unable to register node "ip-172-28-68-69.eu-west-1.compute.internal" with API server: nodes "ip-172-28-68-69.eu-west-1.compute.internal" is forbidden: node "k8s-master.my.fqdn" cannot modify node "ip-172-28-68-69.eu-west-1.compute.internal" kubelet_node_status.go:107]无法向API服务器注册节点“ ip-172-28-68-69.eu-west-1.compute.internal”:节点“ ip-172-28-68-69.eu-west” -1.compute.internal”被禁止:节点“ k8s-master.my.fqdn”不能修改节点“ ip-172-28-68-69.eu-west-1.compute.internal”

I already tried to set --host-override flag to "k8s-master.my.fqdn" with no success. 我已经尝试将--host-override标志设置为"k8s-master.my.fqdn" ,但没有成功。

(kubectl get nodes:
NAME                    STATUS    ROLES     AGE       VERSION
k8s.my.fqdn             Ready     <none>    29m       v1.8.1)

How should I start kubelet in order to successful register on/to AWS? 如何成功启动kubelet才能成功在AWS上注册?

I solved my issue in this way: 我以这种方式解决了我的问题:

  1. Don't change default amazon hostname to your own because --host-override flag isn't working. 请勿将默认的Amazon主机名更改为您自己的主机名,因为--host-override标志不起作用。
  2. Init node like: kubeadm init --pod-network-cidr=10.233.0.0/16 --node-name=$(curl http://169.254.169.254/latest/meta-data/local-hostname) or simply use kubespray as a cluster management solution. 初始化节点,例如: kubeadm init --pod-network-cidr=10.233.0.0/16 --node-name=$(curl http://169.254.169.254/latest/meta-data/local-hostname)或只使用kubespray作为集群管理解决方案。

BTW if you want to integrate with amazon it's better to leave amazon hostname as is. 顺便说一句,如果您想与Amazon集成,最好保留Amazon主机名。 Same I found in kubespray doc: 我在kubespray文档中发现的内容与之相同:

The next step is to make sure the hostnames in your inventory file are identical to your internal hostnames in AWS. 下一步是确保清单文件中的主机名与AWS中的内部主机名相同。 This may look something like ip-111-222-333-444.us-west-2.compute.internal 这可能看起来像ip-111-222-333-444.us-west-2.compute.internal

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM