5.0 KiB
🖥️ Kubernetes Dashboard Setup
There are several ways to view and manage your Kubernetes cluster. Here are the best options:
Option 1: Kubernetes Dashboard (Web UI) ⭐ Recommended
The official Kubernetes Dashboard provides a web-based UI for viewing and managing your cluster.
Install Dashboard
cd kubernetes
kubectl apply -f manifests/dashboard.yaml
Access Dashboard
Method 1: Using kubectl proxy (Recommended for local access)
# Start proxy
kubectl proxy
# Dashboard will be available at:
# http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
Method 2: Port Forward (Direct access)
# Port forward to access dashboard
kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 8443:443
# Or use HTTP port (9090)
kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 9090:9090
# Then visit: http://localhost:9090
Method 3: Expose via Service (For remote access)
# Change service type to NodePort or LoadBalancer
kubectl patch svc kubernetes-dashboard -n kubernetes-dashboard -p '{"spec":{"type":"NodePort"}}'
# Get the port
kubectl get svc -n kubernetes-dashboard
Login to Dashboard
The dashboard is configured with --enable-skip-login, so you can skip the login screen. However, if you need to authenticate:
- Get the token:
kubectl -n kubernetes-dashboard create token admin-user
- Copy the token and paste it in the dashboard login screen.
What You Can See
- ✅ All pods, services, deployments
- ✅ Resource usage (CPU, memory)
- ✅ Logs from pods
- ✅ Events and errors
- ✅ Namespaces
- ✅ ConfigMaps and Secrets
- ✅ Persistent volumes
- ✅ And much more!
Option 2: k9s (Terminal UI) 🚀 Fast & Lightweight
k9s is a terminal-based UI that's super fast and doesn't require a browser.
Install k9s
On Linux:
wget https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_amd64.tar.gz
tar xvf k9s_Linux_amd64.tar.gz
sudo mv k9s /usr/local/bin/
On Windows (using Chocolatey):
choco install k9s
On macOS:
brew install k9s
Use k9s
# Just run k9s - it will connect to your current kubectl context
k9s
# Or specify namespace
k9s -n nats-backend
k9s Keyboard Shortcuts
:pods- View pods:svc- View services:deploy- View deployments:ns- Switch namespaced- Describe resourcel- View logse- Edit resourceCtrl+D- Delete resource?- Helpq- Quit
Option 3: Lens (Desktop App) 💻
Lens is a powerful desktop application for Kubernetes management.
Install Lens
Download from: https://k8slens.dev/
- Windows: Download installer from website
- Linux: Download AppImage or .deb/.rpm
- macOS: Download .dmg
Connect to k3s
- Open Lens
- Click "Add Cluster"
- Paste your kubeconfig (from
/etc/rancher/k3s/k3s.yamlon server) - Or Lens can auto-detect k3s if running locally
Option 4: Rancher UI (For k3s)
Since you're using k3s (from Rancher), you can also use Rancher UI.
Install Rancher
# Install Rancher (optional - adds overhead)
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm repo update
kubectl create namespace cattle-system
helm install rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=rancher.yourdomain.com
Note: Rancher is heavier and more complex. Only use if you need advanced features.
Quick Comparison
| Tool | Type | Best For | Resource Usage |
|---|---|---|---|
| Kubernetes Dashboard | Web UI | Visual overview, beginners | Medium |
| k9s | Terminal | Fast operations, CLI lovers | Low |
| Lens | Desktop | Full-featured, professional | Medium |
| Rancher | Web UI | Multi-cluster, enterprise | High |
Recommended Setup
For your use case, I recommend:
- Kubernetes Dashboard - For web-based viewing and monitoring
- k9s - For quick terminal-based operations
Both can be used together!
Troubleshooting
Dashboard not loading?
# Check if dashboard is running
kubectl get pods -n kubernetes-dashboard
# Check logs
kubectl logs -n kubernetes-dashboard deployment/kubernetes-dashboard
# Restart dashboard
kubectl rollout restart deployment/kubernetes-dashboard -n kubernetes-dashboard
Can't access dashboard?
- Ensure
kubectl proxyis running (for Method 1) - Check firewall rules if accessing remotely
- Verify port-forward is working:
kubectl get svc -n kubernetes-dashboard
Permission denied?
The dashboard has full cluster access via the admin-user service account. If you see permission errors, check:
kubectl get clusterrolebinding admin-user
kubectl get serviceaccount admin-user -n kubernetes-dashboard
Next Steps
- Deploy the dashboard:
kubectl apply -f manifests/dashboard.yaml - Access it:
kubectl proxythen visit the URL - Explore your
nats-backendnamespace!
Enjoy your Kubernetes UI! 🎉