feat: Add nginx-nodeport example with comprehensive documentation and security comparison

This commit is contained in:
mik-tf
2025-11-06 20:07:50 -05:00
parent 78a7f4c89f
commit d293c00794
9 changed files with 1860 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
# Nginx-NodePort Deployment Validation Guide
This document provides step-by-step deployment and validation procedures for the nginx-nodeport implementation.
## 🚀 Deployment Instructions
### Prerequisites
- Kubernetes cluster access (kubectl configured)
- Mycelium Cloud environment with IPv6 support
- bash shell for running test scripts
### Step-by-Step Deployment
```bash
# 1. Navigate to the nginx-nodeport directory
cd myceliumcloud-examples/examples/nginx-nodeport
# 2. Deploy the ConfigMaps (content and nginx configuration)
kubectl apply -f nginx-nodeport-configmaps.yaml
# 3. Deploy the nginx application (secure pod deployment)
kubectl apply -f nginx-nodeport-deployment.yaml
# 4. Create the NodePort service
kubectl apply -f nginx-nodeport-service.yaml
# 5. Wait for deployment to be ready
kubectl wait --for=condition=ready pod -l app=nginx-nodeport --timeout=60s
# 6. Verify deployment
kubectl get all -l app=nginx-nodeport
```
## 🔍 Validation Procedures
### 1. Basic Functionality Tests
```bash
# Test pod health
kubectl get pods -l app=nginx-nodeport
kubectl describe pod -l app=nginx-nodeport
# Test nginx configuration
POD_NAME=$(kubectl get pods -l app=nginx-nodeport -o name | head -1)
kubectl exec $POD_NAME -- nginx -t
# Test health endpoint
kubectl exec $POD_NAME -- curl -s http://localhost:8080/health
# Expected: "healthy"
```
### 2. IPv6 Accessibility Tests
```bash
# Get node IPv6 address (IPv4 + IPv6 extraction issue fix)
NODE_IPV6=$(kubectl get nodes -o jsonpath='{range .items[0].status.addresses[?(@.type=="InternalIP")]}{.address}{"\n"}{end}' | grep -E '^[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+$' | head -1)
# Test external IPv6 connectivity
curl -6 "http://[$NODE_IPV6]:30091/"
curl -6 "http://[$NODE_IPV6]:30091/health"
# Verify website displays correctly
curl -6 "http://[$NODE_IPV6]:30091/" | grep -i "nodeport secure"
# Expected: Should find "NODEPORT SECURE" text
```
### 3. Automated Testing
```bash
# Run the comprehensive test script
./test-nodeport-ipv6.sh
# Expected output:
# ✅ Connected to Kubernetes cluster
# ✅ nginx-nodeport deployment found
# ✅ nginx-nodeport pods are ready
# ✅ nginx configuration is valid
# ✅ Health endpoint is working
# ✅ NodePort service is configured
# ✅ NodePort: 30091
# ✅ Node IPv6 address: [YOUR_IPV6]
# ✅ External IPv6 connectivity is working!
```
## 🎯 Success Criteria
### Primary Success Indicators
- [ ] **Pod Status**: kubectl get pods shows nginx-nodeport pod in "Running" status
- [ ] **Service Status**: kubectl get svc shows nginx-nodeport-service with NodePort 30091
- [ ] **Health Endpoint**: curl -6 "http://[$NODE_IPV6]:30091/health" returns "healthy"
- [ ] **Website Access**: curl -6 "http://[$NODE_IPV6]:30091" returns HTML with "NODEPORT SECURE"
- [ ] **IPv6 Connectivity**: External IPv6 access works from outside the cluster
- [ ] **nginx Logs**: kubectl logs deployment/nginx-nodeport shows access logs
**Your website will be accessible at**: http://[YOUR-NODE-IPV6]:30091
**Success indicator**: Website displays "NODEPORT SECURE" and "ENHANCED SECURITY" badges with professional styling and IPv6 address detection.