简体   繁体   中英

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:

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"

I already tried to set --host-override flag to "k8s-master.my.fqdn" with no success.

(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?

I solved my issue in this way:

  1. Don't change default amazon hostname to your own because --host-override flag isn't working.
  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.

BTW if you want to integrate with amazon it's better to leave amazon hostname as is. Same I found in kubespray doc:

The next step is to make sure the hostnames in your inventory file are identical to your internal hostnames in AWS. This may look something like ip-111-222-333-444.us-west-2.compute.internal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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