1 Antwort
- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
0
kubectl get nodes <NODE_NAME> -oyaml
returns information about the node that includes the EC2 instance ID:
apiVersion: v1
kind: Node
metadata:
annotations:
node.alpha.kubernetes.io/ttl: "0"
volumes.kubernetes.io/controller-managed-attach-detach: "true"
labels:
alpha.eksctl.io/cluster-name: <CLUSTER_NAME>
alpha.eksctl.io/nodegroup-name: <NODEGROUP_NAME>
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/instance-type: m5.large
beta.kubernetes.io/os: linux
eks.amazonaws.com/capacityType: ON_DEMAND
eks.amazonaws.com/nodegroup: <NODEGROUP_NAME>
eks.amazonaws.com/nodegroup-image: <AMI_ID>
eks.amazonaws.com/sourceLaunchTemplateId: <LAUNCH_TEMPLATE_ID>
eks.amazonaws.com/sourceLaunchTemplateVersion: "1"
failure-domain.beta.kubernetes.io/region: <REGION>
failure-domain.beta.kubernetes.io/zone: <AVAILABILITY_ZONE>
k8s.io/cloud-provider-aws: <ID>
kubernetes.io/arch: amd64
kubernetes.io/hostname: <HOST_NAME>
kubernetes.io/os: linux
node.kubernetes.io/instance-type: m5.large
topology.kubernetes.io/region: <REGION>
topology.kubernetes.io/zone: <AVAILABILITY_ZONE>
name: <HOST_NAME>
spec:
providerID: aws:///<AZ>/<EC2_INSTANCE_ID>
The spec.providerID
gives you the AWS AZ and the EC2 instance ID. With those items, you could use the SDK to look up additional instance info.
beantwortet vor 2 Jahren
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor 6 Monaten
- AWS OFFICIALAktualisiert vor 3 Jahren
- AWS OFFICIALAktualisiert vor 3 Jahren
- AWS OFFICIALAktualisiert vor einem Jahr
Thank you for your reply but, I want to use golang api. not kubectl. I couldn't find any api. It seem "getNode" function does not exist.