Lab 06 Troubleshooting
Common Issues and Solutions
Provider-Specific Cluster Issues
Kind Cluster Not Starting
Problem: Kind cluster creation fails
Solutions:
Check Docker is running:
bashdocker psCheck available resources:
bashdocker info | grep -i memoryDelete and recreate:
bashkind delete cluster --name multi-tenant-cluster kind create cluster --name multi-tenant-cluster
GKE Cluster Creation Fails
Problem: Terraform fails to create GKE cluster
Solutions:
Check APIs enabled:
bashgcloud services enable container.googleapis.com compute.googleapis.comCheck quotas:
bashgcloud compute project-info describe --project=$PROJECT_IDCheck permissions:
bashgcloud projects get-iam-policy $PROJECT_ID
EKS Cluster Creation Fails
Problem: Terraform fails to create EKS cluster
Solutions:
Check service-linked role exists:
bashaws iam get-role --role-name AWSServiceRoleForAmazonEKS || \ aws iam create-service-linked-role --aws-service-name eks.amazonaws.comCheck IAM permissions:
bashaws sts get-caller-identity # Verify you have eks:CreateCluster, eks:DescribeCluster permissionsCheck service quotas:
bashaws service-quotas get-service-quota \ --service-code eks \ --quota-code L-1194A341
Cannot Access Cluster (kubectl)
Problem: kubectl cluster-info fails
GCP Solution:
CLUSTER_NAME=$(terraform output -raw cluster_name)
REGION=$(grep region terraform.tfvars | cut -d'"' -f2)
PROJECT_ID=$(grep project_id terraform.tfvars | cut -d'"' -f2)
gcloud container clusters get-credentials $CLUSTER_NAME \
--region $REGION \
--project $PROJECT_IDAWS Solution:
CLUSTER_NAME=$(terraform output -raw cluster_name)
REGION=$(grep -E '^region\s*=' terraform.tfvars | sed 's/.*=\s*"\(.*\)".*/\1/' | tr -d ' ')
aws eks update-kubeconfig \
--region $REGION \
--name $CLUSTER_NAMETenant Creation Issues
Tenant Script Fails
Problem: create-tenant.sh script fails
Solutions:
Check kubectl access:
bashkubectl cluster-infoCheck script permissions:
bashchmod +x tenant-onboarding/create-tenant.shRun manually:
bash# Create namespace kubectl create namespace tenant-a # Apply resources manually kubectl apply -f tenant-onboarding/tenant-namespace.yaml # (replace {{TENANT_NAME}} first)
Namespace Already Exists
Problem: Namespace already exists error
Solutions:
Delete existing namespace:
bashkubectl delete namespace tenant-aOr use existing namespace:
bash# Apply resources to existing namespace kubectl apply -f tenant-onboarding/tenant-quotas.yaml -n tenant-a
RBAC Issues
User Can't Access Namespace
Problem: User gets "forbidden" errors
Solutions:
Check RoleBinding:
bashkubectl get rolebinding -n tenant-a kubectl describe rolebinding -n tenant-aVerify user in RoleBinding:
bashkubectl get rolebinding tenant-admin -n tenant-a -o yaml # Check subjects sectionCreate/update RoleBinding:
bashkubectl create rolebinding tenant-a-user \ --role=tenant-admin \ --user=user@example.com \ -n tenant-a
Service Account Can't Create Resources
Problem: Service account gets permission denied
Solutions:
Check service account:
bashkubectl get serviceaccount -n tenant-aCheck RoleBinding for service account:
bashkubectl get rolebinding -n tenant-a # Should have binding for service accountCreate RoleBinding:
bashkubectl create rolebinding tenant-sa-binding \ --role=tenant-admin \ --serviceaccount=tenant-a:tenant-app \ -n tenant-a
Resource Quota Issues
Pod Creation Fails: Quota Exceeded
Problem: Can't create pod, quota exceeded
Solutions:
Check quota usage:
bashkubectl describe resourcequota -n tenant-aCheck current usage:
bashkubectl get pods -n tenant-a kubectl top pods -n tenant-aIncrease quota:
bashkubectl edit resourcequota tenant-quota -n tenant-a # Increase limitsOr delete unused resources:
bashkubectl delete pod <unused-pod> -n tenant-a
Quota Not Enforced
Problem: Pods created despite exceeding quota
Solutions:
Verify ResourceQuota exists:
bashkubectl get resourcequota -n tenant-aCheck quota status:
bashkubectl describe resourcequota -n tenant-a # Should show "Used" and "Hard" limitsVerify namespace:
bashkubectl get namespace tenant-a # Ensure namespace exists and quota is applied
Network Policy Issues
Pods Can't Communicate Within Namespace
Problem: Pods in same namespace can't reach each other
Solutions:
Check network policy:
bashkubectl get networkpolicy -n tenant-a kubectl describe networkpolicy -n tenant-aVerify policy allows same-namespace traffic:
yaml# Should have: ingress: - from: - namespaceSelector: matchLabels: name: tenant-aTemporarily remove network policy to test:
bashkubectl delete networkpolicy -n tenant-a # Test connectivity # Recreate policy with correct rules
Can't Access Shared Services
Problem: Tenant pods can't reach shared services
Solutions:
Check shared services network policy:
bashkubectl get networkpolicy -n shared-services kubectl describe networkpolicy -n shared-servicesVerify tenant namespace has tenant label:
bashkubectl get namespace tenant-a --show-labels # Should have tenant=tenant-a labelCheck shared services policy allows tenant namespaces:
yaml# Should have: ingress: - from: - namespaceSelector: matchExpressions: - key: tenant operator: Exists
Cross-Tenant Communication Works (Shouldn't)
Problem: Tenants can communicate (isolation not working)
Solutions:
Check network policies exist:
bashkubectl get networkpolicy --all-namespacesVerify policies block cross-tenant traffic:
bashkubectl describe networkpolicy -n tenant-a # Should NOT allow tenant-b namespaceCheck CNI supports NetworkPolicy:
GCP:
bashgcloud container clusters describe <cluster> --region <region> \ --format="get(networkPolicy.enabled)" # Should be TrueAWS:
bash# EKS uses VPC CNI which supports NetworkPolicy by default # Verify VPC CNI addon is installed aws eks describe-addon \ --cluster-name <cluster-name> \ --addon-name vpc-cni \ --region <region>Kind:
bash# Kind supports NetworkPolicy by default (Calico or Cilium) kubectl get nodes # Network policies work out of the box
General Debugging
Check Tenant Resources
# List all tenant namespaces
kubectl get namespaces -l tenant
# Check resources in tenant
kubectl get all -n tenant-a
# Check quotas
kubectl get resourcequota -n tenant-a
# Check network policies
kubectl get networkpolicy -n tenant-a
# Check RBAC
kubectl get role,rolebinding -n tenant-aTest Isolation
# Test RBAC
kubectl auth can-i get pods -n tenant-b --as=system:serviceaccount:tenant-a:default
# Test network (from tenant-a pod)
kubectl run test --image=busybox -n tenant-a --rm -it --restart=Never -- \
wget -O- --timeout=5 http://<tenant-b-service>.tenant-b.svc.cluster.local
# Test quota
kubectl run test --image=nginx -n tenant-a \
--requests=cpu=10,memory=20GiView Logs
# Pod logs
kubectl logs <pod-name> -n tenant-a
# Events
kubectl get events -n tenant-a --sort-by='.lastTimestamp'
# Describe resources
kubectl describe pod <pod-name> -n tenant-aProvider-Specific Debugging
GCP:
# Check cluster status
gcloud container clusters describe <cluster-name> --region <region> --project <project-id>
# Check node pools
gcloud container node-pools list --cluster <cluster-name> --region <region> --project <project-id>AWS:
# Check cluster status
aws eks describe-cluster --name <cluster-name> --region <region>
# Check node groups
aws eks list-nodegroups --cluster-name <cluster-name> --region <region>
# Check node group details
aws eks describe-nodegroup \
--cluster-name <cluster-name> \
--nodegroup-name <nodegroup-name> \
--region <region>Getting Help
If you're still experiencing issues:
Check Documentation:
Review Kubernetes Documentation:
Open an Issue: Include:
- Error messages
kubectlcommand results- Network policy configurations
- RBAC configurations
- Provider (Kind, GCP, or AWS)
- Cluster region/zone
Prevention Tips
- Test Isolation - Verify each layer works
- Document Configuration - Keep records of tenant setup
- Monitor Quotas - Watch quota usage regularly
- Review RBAC - Audit permissions periodically
- Test Network Policies - Verify isolation works
- Use Scripts - Automated tenant creation reduces errors
- Start with Kind - Test locally before deploying to cloud