Setting Up Kubernetes Dashboard Securely is a common requirement for VPS administrators. This guide provides practical instructions that you can follow on Ubuntu 22.04/24.04 or Debian 12, though most steps apply to other distributions as well.
Deploying the Application
For production deployments, consider implementing high availability by running multiple instances behind a load balancer. This approach provides both redundancy and improved performance under heavy load.
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: dashboard-app
labels:
app: dashboard
spec:
replicas: 2
selector:
matchLabels:
app: dashboard
template:
metadata:
labels:
app: dashboard
spec:
containers:
- name: dashboard
image: dashboard:latest
ports:
- containerPort: 8080
resources:
requests:
memory: "128Mi"
cpu: "250m"
limits:
memory: "256Mi"
cpu: "500m"
This configuration provides a good balance between performance and resource usage. For high-traffic scenarios, you may need to increase the limits further.
Configuring Services and Ingress
Performance benchmarks show that properly tuned dashboard can handle significantly more concurrent connections than the default configuration. The key improvements come from adjusting worker processes and connection pooling.
# Apply the configuration
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
# Verify the deployment
kubectl get pods -l app=dashboard
kubectl describe deployment dashboard-app
kubectl logs -f deployment/dashboard-app
These commands should be run as root or with sudo privileges. If you're using a non-root user, prefix each command with sudo.
Advanced Settings
It's recommended to test this configuration in a staging environment before deploying to production. This helps identify potential compatibility issues and allows you to benchmark performance differences.
Wrapping Up
Following this guide, your dashboard setup should be production-ready. Keep an eye on resource usage as your traffic grows and don't forget to test your backup and recovery procedures periodically.