Initial commit: k8s cluster manifests and scripts
This commit is contained in:
26
apps/postgres/status.sh
Executable file
26
apps/postgres/status.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# 用途:查看 Postgres 狀態與連線資訊
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo
|
||||
echo "=== Pod ==="
|
||||
kubectl get pod -l app=postgres -o wide
|
||||
|
||||
echo
|
||||
echo "=== Service ==="
|
||||
kubectl get svc postgres
|
||||
|
||||
echo
|
||||
echo "=== PVC ==="
|
||||
kubectl get pvc postgres-pvc
|
||||
|
||||
echo
|
||||
echo "=== NodePort 連線 ==="
|
||||
NODE_IPS=$(kubectl get nodes -o jsonpath='{range .items[*]}{.status.addresses[?(@.type=="InternalIP")].address}{" "}{end}')
|
||||
PORT=$(kubectl get svc postgres -o jsonpath='{.spec.ports[0].nodePort}')
|
||||
|
||||
for ip in $NODE_IPS; do
|
||||
echo "- $ip:$PORT"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user