Difference between revisions of "Kubectl get nodes"

From wikieduonline
Jump to navigation Jump to search
Line 14: Line 14:
 
* <code>kubectl get nodes -A -o yaml | egrep "node.kubernetes.io/instances-type|name: ip|capacity-type" | grep -v address | grep -v hostname</code>
 
* <code>kubectl get nodes -A -o yaml | egrep "node.kubernetes.io/instances-type|name: ip|capacity-type" | grep -v address | grep -v hostname</code>
 
* <code>kubectl get nodes -A -o wide | awk '{print $6}' | grep -v [[INTERNAL-IP]]</code>
 
* <code>kubectl get nodes -A -o wide | awk '{print $6}' | grep -v [[INTERNAL-IP]]</code>
* <code>kubectl get nodes -o json | [[jq]] ".items[] | {name:.metadata.name} + .status.capacity"</code>
+
* <code>kubectl get nodes -o json | [[jq]] ".items[] | {name:.metadata.name} + [[.status.capacity]]"</code>
  
  

Revision as of 11:37, 20 March 2024

https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/


Examples

kubectl get nodes
NAME           STATUS   ROLES    AGE   VERSION
node2          Ready    <none>   23h   v1.14.3-docker-2
ubuntu1804-1   Ready    master   23h   v1.14.3-docker-2
kubectl get nodes
NAME             STATUS   ROLES    AGE   VERSION
172.17.255.254   Ready    master   11d   v1.14.8
kubectl get nodes 
NAME     STATUS   ROLES    AGE   VERSION 
master   Ready    master   67m   v1.14.0
node01   Ready    <none>   67m   v1.14.0

Official doc:

kubectl get nodes
NAME                     STATUS       ROLES     AGE     VERSION
kube-worker-1            NotReady     <none>    1h      v1.23.3
kubernetes-node-bols     Ready        <none>    1h      v1.23.3
kubernetes-node-st6x     Ready        <none>    1h      v1.23.3
kubernetes-node-unaj     Ready        <none>    1h      v1.23.3

EKS

kubectl get nodes
NAME                                           STATUS   ROLES    AGE     VERSION
ip-192-168-72-109.us-east-2.compute.internal   Ready    <none>   9m38s   v1.21.5-eks-bc4871b
ip-192-168-8-185.us-east-2.compute.internal    Ready    <none>   9m34s   v1.21.5-eks-bc4871b

Terraform example:

kubectl get nodes
NAME                                       STATUS   ROLES    AGE   VERSION
ip-10-0-1-48.us-east-2.compute.internal    Ready    <none>   32m   v1.20.11-eks-f17b81
ip-10-0-1-85.us-east-2.compute.internal    Ready    <none>   33m   v1.20.11-eks-f17b81
ip-10-0-3-153.us-east-2.compute.internal   Ready    <none>   32m   v1.20.11-eks-f17b81
kubectl get nodes
NAME                                       STATUS   ROLES    AGE     VERSION
ip-10-0-1-149.us-east-2.compute.internal   Ready    <none>   5h40m   v1.20.11-eks-f17b81
ip-10-0-2-121.us-east-2.compute.internal   Ready    <none>   5h40m   v1.20.11-eks-f17b81

GKE

kubectl get nodes
NAME                                           STATUS                     ROLES    AGE    VERSION
gke-your-pool-1-040c69dc-gq56                   Ready                      <none>   30h    v1.21.11-gke.1900
gke-your-pool-2-040c69dc-ncj5                   Ready                      <none>   30h    v1.21.11-gke.1900
gke-your-pool-2-040c69dc-rkj2                   Ready                      <none>   30h    v1.21.11-gke.1900
gke-your-pool-3-737b2f5f-tbu5                   Ready,SchedulingDisabled   <none>   28h    v1.21.11-gke.1900


Errors

kubectl get nodes
Unable to connect to the server: dial tcp: lookup 00A50xxxx.gr7.us-east-2.eks.amazonaws.com: no such host

Solution: review ~/.kube/config
kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?
kubectl get nodes
Unable to connect to the server: EOF
kubectl get nodes
error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

Minikube

kubectl get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   38d   v1.27.4
kubectl get nodes
NAME       STATUS   ROLES                  AGE     VERSION
minikube   Ready    control-plane,master   3d21h   v1.21.2
kubectl get nodes
NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    master   12m   v1.18.0

kind

k get no
NAME                 STATUS   ROLES           AGE     VERSION
kind-control-plane   Ready    control-plane   4m44s   v1.29.2
kubectl get nodes
NAME                 STATUS   ROLES                  AGE   VERSION
kind-control-plane   Ready    control-plane,master   10m   v1.20.2

KillerCoda

kubectl get nodes
NAME           STATUS   ROLES           AGE   VERSION
controlplane   Ready    control-plane   23d   v1.25.3
node01         Ready    <none>          23d   v1.25.3


kubectl get nodes --show-labels (See also: Kubectl label)
kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?
kubectl get nodes -w
kubectl get nodes
error: You must be logged in to the server (Unauthorized)

Related

See also

Advertising: