Kubernetes Installation
Kubernetes Installation
Section titled “Kubernetes Installation”Deploy SSH-KLM on Kubernetes for production environments requiring high availability and scalability.
Use Cases
Section titled “Use Cases”- Production deployments
- High availability requirements
- Large-scale environments (100+ hosts)
- Cloud-native infrastructure
Prerequisites
Section titled “Prerequisites”| Requirement | Version | Notes |
|---|---|---|
| Kubernetes | 1.25+ | kubectl version |
| Helm | 3.10+ | helm version |
| kubectl | Configured | Cluster access |
| Storage Class | Default | For PVCs |
Step-by-Step Guide
Section titled “Step-by-Step Guide”Step 1: Add Helm Repository
Section titled “Step 1: Add Helm Repository”# Add QCecuring Helm repohelm repo add qcecuring https://charts.qcecuring.comhelm repo update
# Verify repo addedhelm search repo qcecuring/ssh-klmStep 2: Create Namespace
Section titled “Step 2: Create Namespace”kubectl create namespace ssh-klmStep 3: Configure Values
Section titled “Step 3: Configure Values”Create values.yaml:
global: storageClass: "standard" # Your storage class
api: replicas: 2 resources: requests: cpu: 500m memory: 512Mi limits: cpu: 2000m memory: 2Gi
worker: replicas: 3 resources: requests: cpu: 250m memory: 256Mi limits: cpu: 1000m memory: 1Gi
postgresql: enabled: true # Set false for external DB auth: postgresPassword: "your-secure-password" database: sshklm
redis: enabled: true auth: password: "your-redis-password"
ingress: enabled: true className: nginx hosts: - host: ssh-klm.example.com paths: - path: / pathType: Prefix tls: - secretName: ssh-klm-tls hosts: - ssh-klm.example.comStep 4: Install Chart
Section titled “Step 4: Install Chart”helm install ssh-klm qcecuring/ssh-klm \ --namespace ssh-klm \ --values values.yaml \ --waitStep 5: Verify Installation
Section titled “Step 5: Verify Installation”# Check podskubectl get pods -n ssh-klm
# Check serviceskubectl get svc -n ssh-klm
# Check ingresskubectl get ingress -n ssh-klmStep 6: Access Dashboard
Section titled “Step 6: Access Dashboard”# If using ingressopen https://ssh-klm.example.com
# If using port-forward (testing)kubectl port-forward svc/ssh-klm-api 8081:8081 -n ssh-klmopen http://localhost:8081Examples
Section titled “Examples”External PostgreSQL
Section titled “External PostgreSQL”# values.yaml for external databasepostgresql: enabled: false
externalDatabase: host: your-rds-instance.amazonaws.com port: 5432 database: sshklm username: sshklm existingSecret: ssh-klm-db-secret existingSecretPasswordKey: passwordCreate the secret:
kubectl create secret generic ssh-klm-db-secret \ --from-literal=password=your-db-password \ -n ssh-klmHigh Availability Setup
Section titled “High Availability Setup”api: replicas: 3 affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchLabels: app: ssh-klm-api topologyKey: kubernetes.io/hostname
worker: replicas: 5
postgresql: architecture: replication readReplicas: replicaCount: 2Troubleshooting
Section titled “Troubleshooting”Pods Not Starting
Section titled “Pods Not Starting”Issue: Pods stuck in Pending state
Solution:
# Check eventskubectl describe pod <pod-name> -n ssh-klm
# Common issues:# - Insufficient resources: Scale down or add nodes# - PVC not binding: Check storage classDatabase Connection Issues
Section titled “Database Connection Issues”Issue: API pods crash with database errors
Solution:
# Check PostgreSQL podkubectl logs -l app.kubernetes.io/name=postgresql -n ssh-klm
# Verify secretkubectl get secret ssh-klm-postgresql -n ssh-klm -o yamlMaintenance
Section titled “Maintenance”Upgrade
Section titled “Upgrade”# Update repohelm repo update
# Upgrade releasehelm upgrade ssh-klm qcecuring/ssh-klm \ --namespace ssh-klm \ --values values.yamlBackup
Section titled “Backup”# Backup PostgreSQLkubectl exec -it ssh-klm-postgresql-0 -n ssh-klm -- \ pg_dump -U postgres sshklm > backup.sql