Skip to content

Commit 45310b6

Browse files
committed
Adding k8s scripts from troubleshooting
1 parent 0be1d07 commit 45310b6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

scripts/cluster-info.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/bash
2+
set -euox pipefail
3+
4+
output_folder="/tmp/$(basename "$0"))"
5+
target_namespaces=(cbci cbci-agents)
6+
mkdir "$output_folder" || echo "$output_folder already exists"
7+
kubectl describe nodes --show-events=true > "$output_folder/nodes.txt"
8+
kubectl cluster-info dump > "$output_folder/cluster.json"
9+
for n in "${target_namespaces[@]}"
10+
do
11+
kubectl get ns "$n" || (echo "Namespace $n does not exist" && exit 1)
12+
kubectl get all -n "$n" -o wide > "$output_folder/get-all-$n.yaml"
13+
kubectl describe pod -n "$n" --show-events=true > "$output_folder/describe-pods-$n.yaml"
14+
done

scripts/metric-server-monitoring.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/bash
2+
set -euox pipefail
3+
4+
namespace_name="namespace-example"
5+
pod_name="jenkins-example-0"
6+
watch -n1 "echo 'NODES\n'; kubectl top nodes; echo '\n\n' ; \
7+
echo 'PODS\n'; kubectl -n ${namespace_name} top pods; echo '\n\n'; \
8+
echo 'CONTAINERS\n'; kubectl -n ${namespace_name} top pod ${pod_name} --containers"

0 commit comments

Comments
 (0)