feat(scripts): add storage provisioner utilities
Add helper scripts for storage management: install-local-path-storage.sh: - Installs Rancher local-path-provisioner - Sets it as default storage class - Useful for local testing and single-node scenarios - Alternative to NFS for simpler setups diagnose-storage.sh: - Diagnoses storage-related issues - Checks for provisioner installation - Lists storage classes and PVC status - Identifies pods stuck due to storage problems 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6c292da5f1
commit
f6a3b57bcc
87
diagnose-storage.sh
Executable file
87
diagnose-storage.sh
Executable file
@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
log_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
log_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
echo "=========================================="
|
||||
echo "Storage Diagnostics"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Check storage classes
|
||||
log_info "Checking available storage classes..."
|
||||
kubectl get storageclass
|
||||
echo ""
|
||||
|
||||
# Check PVCs
|
||||
log_info "Checking PersistentVolumeClaims in gitlab namespace..."
|
||||
kubectl get pvc -n gitlab
|
||||
echo ""
|
||||
|
||||
# Check PVC details
|
||||
log_info "Detailed PVC status..."
|
||||
kubectl describe pvc -n gitlab
|
||||
echo ""
|
||||
|
||||
# Check pods
|
||||
log_info "Checking pods in gitlab namespace..."
|
||||
kubectl get pods -n gitlab
|
||||
echo ""
|
||||
|
||||
# Check pod events
|
||||
log_info "Checking events in gitlab namespace..."
|
||||
kubectl get events -n gitlab --sort-by='.lastTimestamp' | tail -20
|
||||
echo ""
|
||||
|
||||
# Summary and recommendations
|
||||
echo "=========================================="
|
||||
log_info "Summary and Recommendations"
|
||||
echo "=========================================="
|
||||
|
||||
# Check if storage class exists
|
||||
if kubectl get storageclass 2>&1 | grep -q "No resources found"; then
|
||||
log_error "No storage class found!"
|
||||
echo ""
|
||||
log_info "Talos Linux does not include a default storage provisioner."
|
||||
log_info "You need to install one of the following:"
|
||||
echo ""
|
||||
echo " 1. Local Path Provisioner (simple, single-node)"
|
||||
echo " - Best for testing/development"
|
||||
echo " - Uses local node storage"
|
||||
echo ""
|
||||
echo " 2. OpenEBS (distributed, multi-node)"
|
||||
echo " - Production-ready"
|
||||
echo " - Supports replication"
|
||||
echo ""
|
||||
echo " 3. Rook-Ceph (distributed, enterprise)"
|
||||
echo " - Full-featured storage solution"
|
||||
echo " - More complex setup"
|
||||
echo ""
|
||||
log_info "I recommend starting with Local Path Provisioner for simplicity."
|
||||
else
|
||||
log_success "Storage class found"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
76
install-local-path-storage.sh
Executable file
76
install-local-path-storage.sh
Executable file
@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
log_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
log_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
echo "=========================================="
|
||||
echo "Installing Local Path Provisioner"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
log_info "This will install Rancher's local-path-provisioner for dynamic storage provisioning."
|
||||
echo ""
|
||||
|
||||
# Create namespace for local-path-provisioner
|
||||
log_info "Creating local-path-storage namespace..."
|
||||
kubectl create namespace local-path-storage --dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
# Apply local-path-provisioner
|
||||
log_info "Deploying local-path-provisioner..."
|
||||
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.28/deploy/local-path-storage.yaml
|
||||
|
||||
# Wait for deployment to be ready
|
||||
log_info "Waiting for local-path-provisioner to be ready..."
|
||||
kubectl wait --for=condition=available --timeout=120s deployment/local-path-provisioner -n local-path-storage
|
||||
|
||||
# Check storage class
|
||||
log_info "Checking storage class..."
|
||||
kubectl get storageclass
|
||||
|
||||
# Set as default storage class
|
||||
log_info "Setting local-path as default storage class..."
|
||||
kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
|
||||
|
||||
log_success "Local Path Provisioner installed successfully!"
|
||||
echo ""
|
||||
|
||||
log_info "Storage configuration:"
|
||||
kubectl get storageclass
|
||||
echo ""
|
||||
|
||||
log_info "Provisioner pods:"
|
||||
kubectl get pods -n local-path-storage
|
||||
echo ""
|
||||
|
||||
echo "=========================================="
|
||||
log_success "Installation Complete!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
log_info "You can now deploy applications that require persistent storage."
|
||||
log_info "PersistentVolumeClaims will automatically be provisioned on the local node."
|
||||
echo ""
|
||||
log_warning "Note: local-path storage is NOT replicated across nodes."
|
||||
log_warning "For production use with HA requirements, consider OpenEBS or Rook-Ceph."
|
||||
echo ""
|
||||
Loading…
Reference in New Issue
Block a user