Accessing the Kubernetes Cluster Dashboard
This guide explains how to expose and access the Kubernetes Dashboard securely via NodePort and the Virtual Router's public IP.
Step 1: SSH into the Controller Node
Use the SSH key added during cluster creation:
ssh -i <ssh-private.key> -p 2222 cloud@<Public-IP-of-Virtual-Router>
Step 2: Verify the Dashboard Service
Run the following command to check the current service status:
kubectl get services --all-namespaces
By default, the Kubernetes Dashboard runs on a ClusterIP, which is not publicly accessible. We’ll recreate it as a NodePort service.
Step 3: Delete the Existing ClusterIP Service
Remove the default service with:
kubectl delete service kubernetes-dashboard -n kubernetes-dashboard
Step 4: Create a NodePort Service for the Dashboard
Create a new YAML definition using a text editor (vi or nano):
vi kubernetes-dashboard-service.yaml
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
type: NodePort
ports:
- port: 443
targetPort: 8443
nodePort: 30001 # You may customize this port as needed
selector:
k8s-app: kubernetes-dashboard
Then apply the new service:
kubectl apply -f kubernetes-dashboard-service.yaml
Step 5: Configure Firewall & Port Forwarding
• Open port 30001 in the firewall via the WebberStop portal. • Create a port forwarding rule for the same port using the Virtual Router’s public IP.
This enables external access from the internet to your internal Kubernetes dashboard service.
Step 6: Access the Dashboard
https://<Public-IP-of-Virtual-Router>:30001
Use a token or a valid kubeconfig to authenticate.
You can generate a token with the following command if RBAC is configured:
kubectl -n kubernetes-dashboard create token admin-user