The latest version Kubernetes commonly used commands Daquan

1  # View all namespace of the operation of the PODS
 2 kubectl GET PODS --all- Namespaces
 3  # view specific pods, remember back with namespace name, oh
 4 kubectl GET PODS Kubernetes-Dashboard-76479d66bb-nj8wr - namespace = kube- System
 5  # View specific information pods
 6 kubectl gET pods -o Wide Kubernetes-Dashboard-76479d66bb-nj8wr - namespace = kube- System
 7  # view the health status of the cluster
 8 kubectl gET cs
 9  # get all Deployment
 10 kubectl gET Deployment --all-Namespaces
 . 11 # lists the namespace all pod comprises uninitialized
 12 is kubectl GET PODS --include- uninitialized
 13 is  # view Deployment ()
 14 kubectl GET Deployment nginx- App
 15  # rc view and Servers
 16 kubectl GET rc, Services
 . 17  # View pods structural information (focus error log analysis by this look)
 18  # controller and service, node equally effective
 19 kubectl DESCRIBE pods xxxxpodsname - namespace = xxxnamespace
 20 # similar to other controllers it is kubectl GET controller is the specific name of
 21  # to view the log pod
22  kubectl logs $ POD_NAME
 23  # View pod variable
 24- kubectl Exec My-nginx-5j8ok - the printenv | grep the SERVICE
 25  # cluster
 26 kubectl GET cs health cluster #
 27 kubectl Cluster- info # cluster core component of the operation of
 28 kubectl GET Namespaces # table space name
 29  kubectl versions version #
 30 kubectl API- versions API #
 31 kubectl gET events View event #
 32 kubectl gET nodes       // get all nodes 
33the Delete the Node k8s2 kubectl   // delete nodes 
34 kubectl rollOut Status Deploy nginx- the Test
 35  # created
 36 kubectl the Create -f ./ nginx.yaml # creating a resource
 37 kubectl the Create - . f # yaml create all the current resource directory
 38 kubectl the Create ./ ./nginx1.yaml -f -f mysql2.yaml # use multiple files to create a resource
 39 kubectl the create -f ./ list of all files in the dir # use the directory to create a resource
 40 kubectl the create -f HTTPS: // git .io / vPieo # url used to create the resource 
41 is kubectl RUN = -i --tty --image busybox busybox ---- POD created with terminal
 42RUN = nginx --image kubectl nginx nginx example a promoter #
 43 is kubectl mybusybox --image = RUN = busybox --replicas . 5     ---- promoter plurality of pod
 44 is  kubectl EXPLAIN PODS, # svc svc acquisition pod and document
 45  # update
 46 is kubectl Python rolling-update-V1-v2.json # -f Python rollover frontend- POD V1
 47 kubectl rolling-update Python Python-V1-V2 = --image Image: V2 # update the resource name and the update image
 48 kubectl update Python---image = rolling Image: v2 # update frontend pod in the mirror
 49 kubectl rolling update Python-Python-v2-v1 - ROLLBACK # quit rolling updates already exist in
 50pod.json CAT | kubectl the replace -f -                               # replaced with pod-based JSON stdin input of
 51  mandatory replacement, re-create the resource after deletion. It will lead to service disruption.
52 is kubectl Replace --force -f ./ pod.json
 53 is Nginx create the RC service, to enable local 80 port attached to the container 8000 port
 54 is kubectl EXPOSE Nginx --port RC = 80 --target-Port = 8000 
55   
56 is  update a single container pod mirrored version (tag) to V4
 57 is kubectl GET pod Nginx -o-pod YAML | Sed ' S / \ (Image: myImage \): * $ / \. 1:. V4 / ' | kubectl Replace -f -
 58 kubectl label-POD PODS Nginx new new -label =awesome # add tags
 59 kubectl Annotate PODS Nginx-POD-icon URL = HTTP: // goo.gl/XXBTWq annotate # 
60 kubectl AutoScale Deployment --min foo = 2 --max = 10                 # automatic expansion Deployment "foo"
 61 is  edit resources #
 62 is kubectl edit SVC / Docker-called edit Registry # docker- -Service Registry of
 63 is KUBE_EDITOR = " Nano " kubectl edit SVC / docker- Registry # other editors
 64  # dynamically scalable POD
 65 kubectl --replicas Scale = 3 rs / foo foo will copy set to become # 3
66 kubectl Scale --replicas = 3 - f # foo.yaml scaling "foo" specified resource.
67 kubectl the --current-Scale Replicas = 2 --replicas = . 3 deployment / mysql # The Deployment / MySQL from three into two
 68 kubectl Scale = --replicas . 5 RC / foo RC / RC bar / baz # Change the number of multiple controllers
 69 kubectl rollOut Deploy Deployment Status / MySQL # to view the progress of change
 70  # delete
 71 kubectl the delete -f ./ pod.json # delete the file type and name pod.json defined in the POD
 72 kubectl delete pod, service baz foo # delete named "baz" the pod and named "foo" in-Service
 73 is kubectl Delete PODS, Services -l # name = myLabel having deleted = name myLabel tag pod and Serivce
 74 kubectl Delete PODS , services -l name = myLabel --include- uninitialized # = delete has a name POD and service myLabel labels, including uninitialized
 75 kubectl -n-ns the delete My PO, --all # svc delete my- under ns namespace of All pod and serivce, including uninitialized
 76 kubectl delete PODS Prometheus-7fcfcb9f89-qkkf7 --grace-period = 0 - force forcibly remove
 77  
78  # interaction
 79 kubectl logs nginx-pod # dump log output pod (stdout)
 80 kubectl logs Nginx-pod MY- -C (case of using stdout, pod in a plurality of containers) container # dump log output pod in the container
 81 kubectl logs -f nginx- pod pod # log output stream (stdout)
 82 kubectl Nginx logs -f-pod MY- -C (case of using stdout, pod has a plurality of container) in the container log pod stream out of container #
 83 kubectl RUN --tty busybox busybox --image = -i - SH # interactive shell run POD
 84 kubectl the attach-POD Nginx - I # running connected to the container
 85 kubectl Nginx Port-forward-POD 5000 : 6000                # forwarding the pod6000 port to the local 5000 port
 86 kubectl Exec Nginx-POD - LS /                          # already exists in the container Run (only a case where the container)
 87 kubectl Exec Nginx-My-POD -C Container - LS /          # (a case where a plurality of containers in pod) Run existing in the container
 88 kubectl pod POD_NAME Top - containers # display metrics specified pod and metric containers
 89  # scheduling configuration
 90 $ kubectl K8S Cordon-labeled my Node # - Node non-dispatchable
 91 is $ kubectl Drain K8S-empty Node # MY- Node to be maintained at
 92 $ kubectl uncordon K8S-labeled MY- Node #node may be scheduled
 93 $ kubectl Top-node node # K8S display MY- node metrics measure
 94 $ kubectl Cluster- info # output current cluster the dump state to stdout                                    
 95 $ kubectl Cluster-info-Directory the dump --output = / path / to cluster-state # output / current state to the cluster / path / to / cluster- state
 96  # key and if the influence of stains (taint) already exists, the value is replaced with the specified
 97 $ foo kubectl taint Nodes = Special Dedicated -user: NoSchedule

Welcome to my personal public concern number, more learning materials waiting for you to come and collect.

Guess you like

Origin www.cnblogs.com/devops-ITboge/p/11012824.html