-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkubectl.5m.sh
executable file
·23 lines (19 loc) · 1.02 KB
/
kubectl.5m.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# <bitbar.title>Kubectl Info</bitbar.title>
# <bitbar.version>v0.1</bitbar.version>
# <bitbar.author>Ian Knighton</bitbar.author>
# <bitbar.author.github>IanKnighton</bitbar.author.github>
# <bitbar.desc>Provides quick access to information on pods and nodes in your kubernetes cluster.<bitbar.desc>
# <bitbar.image>https://stknightondev.blob.core.windows.net/images/bitbar-kubectl.png</bitbar.image>
# <bitbar.dependencies>kubectl</bitbar.dependencies>
# <bitbar.abouturl>https://github.com/IanKnighton/bitbar-kubectl</bitbar.abouturl>
LANG="en_US.UTF-8"
# You may need to update the PATH to include minikube and kubectl
PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export LANG PATH
CURRENT_NODES=`kubectl get nodes`
CURRENT_PODS=`kubectl get pods`
RUNNING_NODE_COUNT=`echo "$CURRENT_NODES" | grep Ready | wc -l | sed -e 's/^[[:space:]]*//'`
RUNNING_POD_COUNT=`echo "$CURRENT_PODS" | grep Running | wc -l | sed -e 's/^[[:space:]]*//'`
echo "Nodes: $RUNNING_NODE_COUNT"
echo "Pods: $RUNNING_POD_COUNT"