I'm trying to expose kubernetes-dashboard through nginx-ingress. The kubernetes-dashboard was not available already but I had initialized all the resources using the following .yaml file shared on the kubernetes official file.
All the resources were provisioned accordingly. Here is the output of the following command I ran to check kubectl get all -n kubernetes-dashboard
Output:
NAME READY STATUS RESTARTS AGE
pod/dashboard-metrics-scraper-8c47d4b5d-7dptt 1/1 Running 1 (78m ago) 9h
pod/kubernetes-dashboard-6c75475678-4c9n2 1/1 Running 0 9h
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/dashboard-metrics-scraper ClusterIP 10.105.70.143 <none> 8000/TCP 14h
service/kubernetes-dashboard NodePort 10.111.136.242 <none> 443:32361/TCP 14h
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/dashboard-metrics-scraper 1/1 1 1 9h
deployment.apps/kubernetes-dashboard 1/1 1 1 9h
NAME DESIRED CURRENT READY AGE
replicaset.apps/dashboard-metrics-scraper-8c47d4b5d 1 1 1 9h
replicaset.apps/kubernetes-dashboard-6c75475678 1 1 1 9h
I also changed the service type for the service/kubernetes-dashboard to NodePort from ClusterIP as shown above in the output.
The following is the yaml file I used to create my ingress resource:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dashboard-ingress
namespace: kubernetes-dashboard
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: test.ml
http:
paths:
- path: /
pathType: Exact
backend:
service:
name: kubernetes-dashboard
port:
number: 443
I can't seem to access the kubernetes-dashboard still. The host in the above yaml is not a legit hostname but I added the following resolution of hostname in my /etc/hosts files as 192.168.49.2 test.ml
The following is the detail about my ingress after running command kubectl get ingress -n kubernetes-dashboard
Output:
NAME CLASS HOSTS ADDRESS PORTS AGE
dashboard-ingress <none> test.ml 192.168.49.2 80 14h
Whenever I try to access the IP address or through the hostname I still can't access my kubernetes-dashboard. I'm using minikube running on my localhost with the VM driver podman and container-runtime is docker.
Please choose a ingress controller and create NodePort for the service to access dashboard application. Below are prerequisites details.
Prerequisites You must have an Ingress controller to satisfy an Ingress. Only creating an Ingress resource has no effect.
You may need to deploy an Ingress controller such as ingress-nginx. You can choose from a number of Ingress controllers.
Ideally, all Ingress controllers should fit the reference specification. In reality, the various Ingress controllers operate slightly differently.