As the enterprise services on the cloud, developers familiar with K8S is conducive to troubleshooting, this article sorted out the common K8S commands, will continue to update and add later.

Kubectl apply -f xx.yaml -n ns // Deploy pod kubectl delete -f xx.yaml -n ns // delete pod kubectl edit deploy podname -n ns Kubectl Edit StatefulSet Wangfeng - c3-n Wangfeng // Update statefulset Kubectl Scale deploy Console-tm-service --replicas=4 -n wangfeng2 kubectl get Pods -n ns kubectl get nodes -n ns Kubectl describe pod XXX -n ns kubectl describe pod XXX -n ns Kubectl logs -f podname -n ns [container name] kubectl label node nodename key=value Kubectl taint node nodename key=value: nodename Docker kubectl exec-it podname -n ns -- /bin/sh // docker exec-it [container_id] /bin/sh // Docker Kubectl cp/TMP /foo <some-namespace>/<some-pod>:/ TMP /bar // copy files or folders kubectl exec wangfeng1-C1-0 -n wangfeng1 -- sh -c 'rm -rf /opt/ Gemini /parta' kubectl create rolebinding "TMP :resource-controller-role-bind-username1" -- ClusterRole =" TMP :resource-controller" --user=username1 -n wangfeng2 // Authorize users to access the clusterCopy the code

Each execution of the Dockerfile instruction creates a new layer on top of the Docker. So too many meaningless layers will cause the image to expand too much. Such as:

The FROM centos RUN yum install wget RUN wget - O redis. Tar. Gz "http://download.redis.io/releases/redis-5.0.3.tar.gz" RUN tar  -xvf redis.tar.gzCopy the code

The above execution creates a layer 3 image. It can be simplified into the following format:

The FROM centos RUN yum install wget \ && wget - O redis. Tar. Gz "http://download.redis.io/releases/redis-5.0.3.tar.gz" \ && tar -xvf redis.tar.gzCopy the code

As shown in the preceding example, the command is joined with &&. After this execution, only 1 layer image is created. Reference: www.runoob.com/docker/dock…