Forrest logo
back to the kubectl tool

kubectl-get:tldr:ab6ae

kubectl-get: Get nodes in a specified namespace.
$ kubectl get nodes -n ${namespace}
try on your machine

This command is used to retrieve information about the nodes in a Kubernetes cluster, where:

  • kubectl is the command-line interface (CLI) for running commands against Kubernetes clusters.
  • get nodes is the command to retrieve information about the nodes.
  • -n ${namespace} is an optional flag to specify the namespace in which you want to perform the command. The ${namespace} variable is used to specify the actual namespace you want to target.

In Kubernetes, a node represents a physical or virtual machine in the cluster that runs application workloads. The kubectl get nodes command allows you to get details about all the nodes in the cluster, including their status (Ready/NotReady), roles (master/worker), internal IP addresses, and external IP addresses.

Adding the -n ${namespace} flag restricts the command to a specific namespace. Namespaces are used to logically isolate resources within a cluster, so if you only want to see the nodes within a particular namespace, you can include this flag.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the kubectl tool