Kubernetes Commands
Access inside a pod
kubectl exec -ti <pod_name> -n <namespace_name> -- /bin/bash
Find and stop pods
for i in `kubectl get deployment -n <namespace> | grep <pod-name-prefix> | awk '{print $1}'`
do
echo $i
kubectl scale deployment $i -n <namespace> --replicas=0
done
Find and start pods
for i in `kubectl get deployment -n <namespace> | grep <pod-name-prefix> | awk '{print $1}'`
do
echo $i
kubectl scale deployment $i -n <namespace> --replicas=1
done
No Comments