Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

Save Resources in K8s, Delete Failed Pods

#!/bin/bash
# This script check the passed namespace and delete pods in 'CrashLoopBackOff state 
NAMESPACE="test"
delpods=$(sudo kubectl get pods -n ${NAMESPACE} |
  grep -i 'CrashLoopBackOff' |
  awk '{print $1 }')    
for i in ${delpods[@]}; do
sudo kubectl delete pod $i --force=true --wait=false 
    --grace-period=0 -n ${NAMESPACE} 
done
Comment

Save Resources in K8s, Delete Failed Pods

#!/bin/bash
# This script check the passed namespace and delete pods in 'CrashLoopBackOff state 
NAMESPACE="test"
delpods=$(sudo kubectl get pods -n ${NAMESPACE} |
  grep -i 'CrashLoopBackOff' |
  awk '{print $1 }')    
for i in ${delpods[@]}; do
sudo kubectl delete pod $i --force=true --wait=false 
    --grace-period=0 -n ${NAMESPACE} 
done
Comment

Save Resources in K8s, Delete Failed Pods

#!/bin/bash
# This script check the passed namespace and delete pods in 'CrashLoopBackOff state 
NAMESPACE="test"
delpods=$(sudo kubectl get pods -n ${NAMESPACE} |
  grep -i 'CrashLoopBackOff' |
  awk '{print $1 }')    
for i in ${delpods[@]}; do
sudo kubectl delete pod $i --force=true --wait=false 
    --grace-period=0 -n ${NAMESPACE} 
done
Comment

Save Resources in K8s, Delete Failed Pods

#!/bin/bash
# This script check the passed namespace and delete pods in 'CrashLoopBackOff state 
NAMESPACE="test"
delpods=$(sudo kubectl get pods -n ${NAMESPACE} |
  grep -i 'CrashLoopBackOff' |
  awk '{print $1 }')    
for i in ${delpods[@]}; do
sudo kubectl delete pod $i --force=true --wait=false 
    --grace-period=0 -n ${NAMESPACE} 
done
Comment

PREVIOUS NEXT
Code Example
Shell :: get git output to terminal instead of less editor 
Shell :: Find all pods that status is NotReady sort jq cheatsheet 
Shell :: make a question in bash script 
Shell :: opera mini for ubuntu 18.04 
Shell :: Activestate windows install 
Shell :: Fix for infinite log Linux bug 
Shell :: command to push code to github 
Shell :: rename branch 
Shell :: kubectl run ubuntu 
Shell :: git create branch based on another branch 
Shell :: ionice 
Shell :: kibana installation 
Shell :: unzip gzip 
Shell :: kill debian login terminal 
Shell :: passphrase 
Shell :: how to view pdf in terminal 
Shell :: forever command 
Shell :: how will you clone the following git repository using git cli? 
Shell :: bash script colors 
Shell :: How to run test with very_good_cli in flutter 
Shell :: cheat.sh github 
Shell :: apt install dbreaver 
Shell :: git pull remote branch that does not exist locally 
Shell :: How to create or generate secret key for django using UUID 
Shell :: How to remove files and directories quickly via terminal (bash shell) 
Shell :: Comparing float or integers in if using bash 
Shell :: linux between subshell variables 
Shell :: composer command to install vendor in magento 2 
Shell :: powershell or bash 
Shell :: golang .profile 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =