

View details about a particular node: kubectl describe nodes By default, the output also lists uninitialized resources.

To display the state of any number of resources in detail, use the kubectl describe command. To use a different editor, specify it in front of the command: KUBE_EDITOR=”” kubectl edit svc/ Displaying the State of Resources This command opens the file in your default editor. This command is a combination of kubectl get and kubectl apply.įor example, to edit a service, type: kubectl edit svc/ You can update a resource by configuring it in a text editor, using the kubectl edit command. json file in a directory: kubectl apply -f yamlĬreate a new replication controller with the definition contained in a.

The source in this operation can be either a file or the standard input ( stdin).Ĭreate a new service with the definition contained in a.

To apply or update a resource use the kubectl apply command. Show a plain-text list of all daemon sets: kubectl get daemonset Creating a ResourceĬreate a resource such as a service, deployment, job, or namespace using the kubectl create command.įor example, to create a new namespace, type: kubectl create namespace Ĭreate a resource from a JSON or YAML file: kubectl create -f Applying and Updating a Resource Generate a plain-text list of all replication controllers and services: kubectl get replicationcontroller,services List a specific replication controller in plain-text: kubectl get replicationcontroller Generate a detailed plain-text list of all pods, containing information such as node name: kubectl get pods -o wideĭisplay a list of all pods running on a particular node server: kubectl get pods -field-selector=spec.nodeName= Show a plain-text list of all pods: kubectl get pods Generate a plain-text list of all namespaces: kubectl get namespaces To list one or more pods, replication controllers, services, or daemon sets, use the kubectl get command. Use the kubectl commands listed below as a quick reference when working with Kubernetes. Note: For more information about the Kubernetes installation, refer to How to Install Kubernetes on a Bare Metal Server.
