Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't able to get externalID ( i.e instanceId provided by aws) of my kubernetes master node

I did try kubectl describe node masterNodeName ,it gives output as :-

Name:               ip-172-28-3-142
    Roles:              master
    Labels:             beta.kubernetes.io/arch=amd64
                        beta.kubernetes.io/os=linux
                        kubernetes.io/arch=amd64
                        kubernetes.io/hostname=ip-172-28-3-142
                        kubernetes.io/os=linux
                        node-role.kubernetes.io/master=
    Annotations:        kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
                        node.alpha.kubernetes.io/ttl: 0
                        projectcalico.org/IPv4Address: 172.28.3.142/20
                        projectcalico.org/IPv4IPIPTunnelAddr: 192.163.119.24
                        volumes.kubernetes.io/controller-managed-attach-detach: true
    CreationTimestamp:  Thu, 06 Jun 2019 04:10:28 +0000
    Taints:             <none>
    Unschedulable:      false
    Conditions:
      Type                 Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message
      ----                 ------  -----------------                 ------------------                ------                       -------
      NetworkUnavailable   False   Sat, 24 Aug 2019 12:10:03 +0000   Sat, 24 Aug 2019 12:10:03 +0000   CalicoIsUp                   Calico is running on this node
      MemoryPressure       False   Tue, 27 Aug 2019 14:08:19 +0000   Tue, 11 Jun 2019 14:38:27 +0000   KubeletHasSufficientMemory   kubelet has sufficient memory available
      DiskPressure         False   Tue, 27 Aug 2019 14:08:19 +0000   Tue, 11 Jun 2019 14:38:27 +0000   KubeletHasNoDiskPressure     kubelet has no disk pressure
      PIDPressure          False   Tue, 27 Aug 2019 14:08:19 +0000   Tue, 11 Jun 2019 14:38:27 +0000   KubeletHasSufficientPID      kubelet has sufficient PID available
      Ready                True    Tue, 27 Aug 2019 14:08:19 +0000   Tue, 11 Jun 2019 14:38:27 +0000   KubeletReady                 kubelet is posting ready status. AppArmor enabled
    Addresses:
      InternalIP:  172.28.3.142
      Hostname:    ip-172-28-3-142
    Capacity:
     cpu:                8
     ephemeral-storage:  20263484Ki
     hugepages-1Gi:      0
     hugepages-2Mi:      0
     memory:             32665856Ki
     pods:               110
    Allocatable:
     cpu:                8
     ephemeral-storage:  18674826824
     hugepages-1Gi:      0
     hugepages-2Mi:      0
     memory:             32563456Ki
     pods:               110
    System Info:
     Machine ID:                 121a679a217040c4aed637a6dc1e0582
     System UUID:                EB219C6D-8C25-AC92-9676-D6B04770257A
     Boot ID:                    144b1dt4-faf8-4fcb-229a-51082410bc5e
     Kernel Version:             4.15.0-2043-aws
               Namespace                  Name                                         CPU Requests  CPU Limits  Memory Requests   

Edit: - I am setting up Kubernetes on aws EC2 instance using kubeadm.

I am looking for a way to get the InstanceID as externalID in node configuration.

My V1Node class cluster info is also null

like image 998
Dhanraj Avatar asked Aug 27 '19 14:08

Dhanraj


2 Answers

ExternalID is deprecated since 1.1.

Unfortunately you cannot get it in versions from 1.11, when it was finally cleaned.

The only way is to rollback/backport that changes and build your own version.

like image 163
Anton Kostenko Avatar answered Sep 28 '22 01:09

Anton Kostenko


Add the cluster name label on ec2 nodes, the value of the label doesn't matter, only the name does. For example

kubernetes.io/cluster/CLUSTER_NAME

kubernetes.io/cluster/dhanvi-test-cluster

Make sure that the IAM policy is set as mentioned at https://github.com/kubernetes/cloud-provider-aws#iam-policy

Use the below config file with kubeadm as kubeadm init --config FILE_NAME.yaml

---
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
apiServer:
  extraArgs:
    cloud-provider: aws
clusterName: dhanvi-test-cluster
controllerManager:
  extraArgs:
    cloud-provider: aws
kubernetesVersion: stable

---
apiVersion: kubeadm.k8s.io/v1beta2
kind: InitConfiguration
nodeRegistration:
  kubeletExtraArgs:
    cloud-provider: aws

Ideally, by doing the above stuff you should be able to get the providerID when you describe the node, it should have also given you the cluster name.

If you are still missing the providerID as a workaround you can still edit the node and add it manually.

Please consider raising an issue at https://github.com/kubernetes/kubeadm/issues if you not getting the providerID even after giving the cloud-provider in the extraArgs.

like image 43
Tummala Dhanvi Avatar answered Sep 28 '22 02:09

Tummala Dhanvi