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