I've already blogged about adding in a kubernetes dashboard in my blog for adding in k3s. I now did not liked to have to open up a proxy everytime I needed to enter the dashboard. So I changed the configuration in my cluster. Check if kubernetes-dashboard is present and running.
kubectl get svc -n kubernetes-dashboard
If yes, let's change the configuration so that we can access our k3s kubernetes dashboard via port .
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2023-03-23T05:16:48Z"
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
resourceVersion: "26202"
uid: fda2b071-819e-4cd9-80c2-33e5dbe97bc4
spec:
clusterIP: 10.43.40.104
clusterIPs:
- 10.43.40.104
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- nodePort: 31126
port: 443
protocol: TCP
targetPort: 8443
selector:
k8s-app: kubernetes-dashboard
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
Note the spec.type to be 'ClusterIP' , Let's change that to NodePort , save and quit. Let's see the node port the kubernetes dashboard is now running at.
kubectl get svc kubernetes-dashboard -n kubernetes-dashboard
Screenshot 2023-03-23 at 11.30.23.png64.9 KB Take note of the port , In my case it is 31126. Might be different for you . Browse to https://YOUR_IP:31126 and you should be able to see kubernetes dashboard .
Screenshot 2023-03-23 at 11.31.38.png179 KB To generate token for sign in , Run the following.