-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kubectl_Commands
11 lines (10 loc) · 4.09 KB
/
Kubectl_Commands
1
2
3
4
5
6
7
8
9
10
seq 1 3 |xargs -I{} -n 1 -P 4 mKube get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.containerStatuses[*].restartCount}{"\t"}{.status.containerStatuses[*].lastState.terminated.reason}{"\t"}{.status.containerStatuses[*].lastState.terminated.startedAt}{"\t"}{.status.containerStatuses[*].lastState.terminated.finishedAt}{"\t"}{.status.containerStatuses[*].lastState.terminated.exitCode}{"\n"}{end}' --sort-by='.status.containerStatuses[0].restartCount' -l app=edge --context cs-prod{} | awk '$2>0' | column -t | sort -k2,2n
seq 1 3 |xargs -I{} -n 1 -P 4 mKube get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.containerStatuses[*].restartCount}{"\t"}{.status.containerStatuses[*].lastState.terminated.reason}{"\t"}{.status.containerStatuses[*].lastState.terminated.startedAt}{"\t"}{.status.containerStatuses[*].lastState.terminated.finishedAt}{"\t"}{.status.containerStatuses[*].lastState.terminated.exitCode}{"\n"}{end}' --sort-by='.status.containerStatuses[0].restartCount' -l app=edge --context cs-prod{} | awk '$2>0' | column -t | sort -k5,5
seq 1 3 | parallel -k -j 5 -I{} mKube get pods -l app=edge -L routeoffer,version --sort-by='.status.containerStatuses[0].restartCount' --context cs-prod{} | hl -g ".*\s0\s.*" -r ".*\s[1-9]\s.*" | column -t -o " "
seq 1 3 |xargs -I{} -n 1 -P 4 mKube get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.labels.routeoffer}{"\t"}{.metadata.labels.version}{"\t"}{.spec.containers[].resources.limits.cpu}{"\t"}{.spec.containers[].resources.limits.memory}{"\n"}{end}' --context cs-prod{} -l app=edge -L routeoffer | sort -k5,5n | column -t -o " "
seq 1 3 |xargs -I{} -n 1 -P 4 mKube get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"|"}{.metadata.creationTimestamp}{"|"}{.status.containerStatuses[*].restartCount}{"|"}{.status.containerStatuses[*].lastState.terminated.exitCode}{"|"}{.status.containerStatuses[*].lastState.terminated.reason}{"|"}{.status.containerStatuses[*].lastState.terminated.startedAt}{"|"}{.status.containerStatuses[*].lastState.terminated.finishedAt}{"|"}{.metadata.labels.routeoffer}{"|"}{.metadata.labels.version}{"|"}{.spec.containers[].resources.limits.cpu}{"|"}{.spec.containers[].resources.limits.memory}{"\n"}{end}' --context cs-prod{} -l app=edge | column -t -s"|" -o " "| sort -k3,3n | hl -r ".*16.*" -b ".*13.*" -y ".*12.*"
seq 1 3 |xargs -I{} -n 1 -P 4 mKube get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"|"}{.metadata.creationTimestamp}{"|"}{.status.containerStatuses[*].restartCount}{"|"}{.status.containerStatuses[*].lastState.terminated.exitCode}{"|"}{.status.containerStatuses[*].lastState.terminated.reason}{"|"}{.status.containerStatuses[*].lastState.terminated.startedAt}{"|"}{.status.containerStatuses[*].lastState.terminated.finishedAt}{"|"}{.metadata.labels.routeoffer}{"|"}{.metadata.labels.version}{"|"}{.spec.containers[].resources.limits.cpu}{"|"}{.spec.containers[].resources.limits.memory}{"\n"}{end}' --context cs-prod{} -l app=hollow-producer | column -t -s"|" -o " "| sort -k3,3n
curl -s "https://cs-catalogservice-hollow-producer-2-0-4.awsw2.cld.dtvops.net/api/overLaps" | jq 'walk(if type == "object" then with_entries(if .key | endswith("DateTime") then .value |= (./1000 | strftime("%Y-%m-%d %H:%M UTC")) end) end)'
curl -s "https://cs-catalogservice-edge-372-3-0.awsw2.cld.dtvops.net/api/nodes?filter=(subType==Channel)&fields=id" | jq -r '. | map({(.id): .status}) | add | keys_unsorted[] as $k | [$k, .[$k]] | join("|")' | sort | awk 'cnt[$1]++{if (cnt[$1]==2) print prev[$1]; print} {prev[$1]=$0}'
curl -s "https://cs-catalogservice-hollow-producer-2-0-4.awsw2.cld.dtvops.net/api/overLaps" | jq -rc '. | values[] | map((.previous.startDateTime, .previous.endDateTime, .current.startDateTime, .current.endDateTime ) |= (./1000 | strftime("%Y-%m-%d %H:%M UTC")))'
aws s3api list-objects --bucket "metadata-hollow-data" --prefix "catalogservice-dev-int-view/" --query "reverse(sort_by(Contents,&LastModified))" | jq -r '.[0:10] | map({(.Key): .Size}) | add | keys_unsorted[] as $k | [$k, .[$k]] | join("|")' | column -t -s"|" -o " "