Restart Namespace all Deployments after k8s v1.15
You can simply use the kubectl rollout restart command that takes care of restarting all the deployments in a namespace
If you specify only the namespace and not a specific deployment, all the deployments in the namespace would be restarted
kubectl rollout restart deployment -n <namespace>
Restart all deployments in Namespace - before k8s v1.15
Instead of manually selecting each deployment in a namespace. you can use this single command to restart all the deployments under the namespace
kubectl get deployments -n <NameSpace Name> -o custom-columns=NAME:.metadata.name|grep -iv NAME|while read LINE; do kubectl rollout restart deployment $LINE -n <NameSpace Name> ; done;
You just have to replace the Namespace
value after -n
in the command
it would traverse through the list of deployments in the namespace and restart them for you.
If you want to restart all the pods in the namespace. You can do the same approach as restarting the deployment is the right way to restart the pods
This is how it looks like during the execution
Hope this helps
Thanks
Sarav AK
Follow me on Linkedin My Profile
Follow DevopsJunction onFacebook orTwitter
For more practical videos and tutorials. Subscribe to our channel
Signup for Exclusive "Subscriber-only" Content
More from Middleware Inventory
-
How to Get Images of all PODs and DeploymentsLet's say you have two similar namespaces in your Kuberentes cluster and you want to compare the images of pods running on both these name spaces. Or Simply want to know what images are being used across the pods (or) deployments in your namespace Of course we are going to…
-
Stop, Start, Restart Windows Service Command Line - How toWindows Service management through the command line is really a good approach when you want to manage plenty of services and perform day to day actions like stop, start and restart I think you would agree, If I say GUI is fun for entry-level but when it comes to performing the…
-
How to perform Oracle Weblogic Deployments - ConsoleOverview Oracle WebLogic Server is a scalable, enterprise-ready Java Platform, Enterprise Edition 7 (Java EE 7) application server. Oracle WebLogic Server is the industry's best application server for building and deploying enterprise Java EE applications with support for new features for lowering the cost of operations, improving performance, enhancing scalability…
-
Get CPU and Memory Usage of NODES and PODS - Kubectl | K8sEver since I started using Kubernetes I have always been on the pursuit of finding the right tools to monitor. and I did find a lot of products from the Open source community and here are my favourites Kube Prometheus Stack KubeCost Kubernetes Dashboard Lens IDE Kubewatch Jaeger Despite having…
-
How to Deploy Tomcat on Kubernetes Step by StepOverview In this post, we are going to see how to deploy tomcat on Kubernetes. How to Deploy Tomcat based web application into Kubernetes. We are taking Google Cloud - Kubernetes Engine (GKE) for our example and creating our Kubernetes Cluster with 3 nodes You can do all these steps…