add
This commit is contained in:
17
998-常用脚本/更新脚本/副本数调整.sh
Normal file
17
998-常用脚本/更新脚本/副本数调整.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
name_space=xmyd
|
||||
|
||||
|
||||
|
||||
kubectl get deployments -n ${xmyd} -o custom-columns='NAME:.metadata.name,REPLICAS:.spec.replicas' --no-headers > deployments_replicas.txt
|
||||
|
||||
|
||||
scale_back_replicas(){
|
||||
while IFS= read -r line; do
|
||||
name=$(echo "$line" | awk '{print $1}')
|
||||
replicas=$(echo "$line" | awk '{print $2}')
|
||||
kubectl scale deployment "$name" --replicas="$replicas" -n ${name_space}
|
||||
done < deployments_replicas.txt
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user