Skip to content

Kubernetes Installation

Deploy SSH-KLM on Kubernetes for production environments requiring high availability and scalability.

  • Production deployments
  • High availability requirements
  • Large-scale environments (100+ hosts)
  • Cloud-native infrastructure
RequirementVersionNotes
Kubernetes1.25+kubectl version
Helm3.10+helm version
kubectlConfiguredCluster access
Storage ClassDefaultFor PVCs
Terminal window
# Add QCecuring Helm repo
helm repo add qcecuring https://charts.qcecuring.com
helm repo update
# Verify repo added
helm search repo qcecuring/ssh-klm
Terminal window
kubectl create namespace ssh-klm

Create values.yaml:

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.com
Terminal window
helm install ssh-klm qcecuring/ssh-klm \
--namespace ssh-klm \
--values values.yaml \
--wait
Terminal window
# Check pods
kubectl get pods -n ssh-klm
# Check services
kubectl get svc -n ssh-klm
# Check ingress
kubectl get ingress -n ssh-klm
Terminal window
# If using ingress
open https://ssh-klm.example.com
# If using port-forward (testing)
kubectl port-forward svc/ssh-klm-api 8081:8081 -n ssh-klm
open http://localhost:8081
# values.yaml for external database
postgresql:
enabled: false
externalDatabase:
host: your-rds-instance.amazonaws.com
port: 5432
database: sshklm
username: sshklm
existingSecret: ssh-klm-db-secret
existingSecretPasswordKey: password

Create the secret:

Terminal window
kubectl create secret generic ssh-klm-db-secret \
--from-literal=password=your-db-password \
-n ssh-klm
values-ha.yaml
api:
replicas: 3
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: ssh-klm-api
topologyKey: kubernetes.io/hostname
worker:
replicas: 5
postgresql:
architecture: replication
readReplicas:
replicaCount: 2

Issue: Pods stuck in Pending state

Solution:

Terminal window
# Check events
kubectl describe pod <pod-name> -n ssh-klm
# Common issues:
# - Insufficient resources: Scale down or add nodes
# - PVC not binding: Check storage class

Issue: API pods crash with database errors

Solution:

Terminal window
# Check PostgreSQL pod
kubectl logs -l app.kubernetes.io/name=postgresql -n ssh-klm
# Verify secret
kubectl get secret ssh-klm-postgresql -n ssh-klm -o yaml
Terminal window
# Update repo
helm repo update
# Upgrade release
helm upgrade ssh-klm qcecuring/ssh-klm \
--namespace ssh-klm \
--values values.yaml
Terminal window
# Backup PostgreSQL
kubectl exec -it ssh-klm-postgresql-0 -n ssh-klm -- \
pg_dump -U postgres sshklm > backup.sql