kubectl–get Command
First, command format
Kubectl Get Resource Name
ii. List of resourceAll Certificatesigningrequests (aka ' CSR ') clusterrolebindings Clusterrol componentstatuses (aka ' CS ') Configmaps (aka ' C ') M ') controllerrevisions cronjobs customresourcedefinition (aka ' CRD ') daemonsets (aka ' DS ') deployments (aka ' Deploy ') end Points (aka ' EP ') (aka ' EV ') horizontalpodautoscalers (aka ' hpa ') ingresses (aka ' ing ') jobs limitranges (aka ' Limi TS ') Namespaces (aka ' NS ') networkpolicies (aka ' Netpol ') nodes (aka ' No ') persistentvolumeclaims (aka ' PVC ') persistentvo Lumes (aka ' PV ') poddisruptionbudgets (aka ' pdb ') Podpreset pods (aka ' po ') podsecuritypolicies (aka ' PSP ') podtemplates R Eplicasets (aka ' RS ') replicationcontrollers (aka ' RC ') Resourcequotas (aka ' quota ') rolebindings roles, Secrets SERVICEACC Ounts (aka ' sa ') Services (aka ' Svc ') statefulsets (aka ' sts ') storageclasses (aka ' SC ')
third, optional parameters
View in a different format
-O Wide/yaml/json
Look at the pods of the specified label, support ' = ', ' = = ', '!= ' operator
-L Key=value
View the specified namespaces
-N namespace Four, example
# View Master status
kubectl get componentstatuses
# View all namespaces
Kubectl get namespace
# List all pods
Kubectl Get Pods
# Displays more Pods list information (for example, pod IP and node)
Kubectl get pods-o wide
# list RC Kubectl get with Name Web
Replicationcontroller Web
# Gets the information of the pod named Web-pod-13je7 and outputs the
kubectl get-o JSON pod web-pod-13je7 in JSON format
# Find pod based on pod file and output
kubectl get-f Pod.yaml-o JSON # in JSON format
the status of Pod containers
kubectl get-o template pod/k Ube-dns-795f5f6f9c-ldxxs--template {{. Status.phase}}
# simultaneously gets all RC and service
kubectl get rc,services
# Gets all rc,svc,pod
kubectl get rc/web service/frontend pods/web-pod-13je7
# gets all resource Kubectl get
All