Cheat sheet for production environment Use kubectl drain to remove a node from service Enabling autocomplete for kubectl Removing a pod from a service Editing kubernetes resources In the following section we list some of the commands that are commonly used in a  production environment.  You can use  kubectl drain  to safely evict all of your pods from a node before you perform  maintenance on the node (for example for kernel upgrade or hardware maintenance). Safe  evictions allow the pod’s containers to  gracefully terminate and respect the  PodDisruptionBudgets that you have specified: kubectl get nodes kubectl drain <node name> kubectl uncordon <node name> This will instruct Kubernetes that it can resume scheduling of new pods onto the node. It might be difficult to remember all of the commands and their arguments for the  kubectl  command. kubectl provides an  autocomplete function  to help you remember the commands  and their arguments. You can enable kubectl autocompletion in your current shell using the  following command: source <(kubectl completion bash) Let’s assume we have a service backed by a number of pods. If one of the pods starts  misbehaving we need to find out the root cause for the same. We need to remove the failing  pod from the list of pods to investigate the problem later. Suppose we have pod foo with the label ‘test’. We update the pod  foo  by removing the label  named  test  if it exists with the following command: $ kubectl label pods foo test- As you remove the label, the pod will be out of service and deployment will spawn a new pod  with the label test. Sometimes in a production environment you need to fine tune Kubernetes resources by  editing them. You can edit the resources using  kubectl edit <resource_name>.  Appendix A. Command line tools  361 1. First, identify the name of the node you wish to drain. You can list all of the nodes in your  cluster with: 2. Next, tell Kubernetes to drain the node: 3. Once it returns without giving an error, you can power down the node (or on a cloud  platform, delete the virtual machine backing the node). If you leave the node in the cluster  during the maintenance operation, you need to run: