Nginx Ingress Controller for Dashboard service on Minikube can be easily installed with this in-depth guide by our experts.
At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Services.
Let’s take a look at how our Support Team is ready to help customers setup Nginx Ingress Controller for Dashboard service on Minikube.
Setting up Nginx Ingress Controller for Dashboard service on Minikube
Today we are going to take a look at how our Support Engineers set up name-based Ingress rules in addition to enabling Ingress controller on Minikube. This permits the Ingress controller to take over and follow through the rules in forwarding requests to kubernetes-dashboard service.
Moreover, our Support Techs will also demonstrate how to map Minikube’s IP to a CNAME in the local /etc/hosts file.
Ingress controllers are pods like other applications. They are a part of the cluster and are able to see other pods. Furthermore, we have to expose them with the help of a Service with type either LoadBalancer or NodePort.
Additionally, the controller has the ability to inspect HTTP requests and direct clients to the correct pod depending on the characteristics like URL path or domain name.
How to install Nginx Ingress Controller on Minikube
- First, we start the Minikube with the following command:
$ minikube start --vm=true --driver=hyperkit
We need to specify the driver in the command as seen above. According to our Support Techs, not using the driver flag results in the Minikube opting for Docker rather than vm.
- Next, we enable the NGINX Ingress controller in the Kubernetes cluster on Minikube with this command:
$ minikube addons enable ingress Verifying ingress addon... The 'ingress' addon is enabled
- Then, execute the command below to see the ingress-nginx-controller pod up and running in the kube-system namespace:
$ kubectl get pods -n kube-system NAME READY STATUS RESTARTS AGE coredns-66bff467f8-r9fxd 1/1 Running 0 3m1s etcd-minikube 1/1 Running 0 3m4s ingress-nginx-admission-create-tctgw 0/1 Completed 0 2m4s ingress-nginx-admission-patch-6bwhd 0/1 Completed 0 2m4s ingress-nginx-controller-69ccf5d9d8-r7724 1/1 Running 0 2m4s kube-apiserver-minikube 1/1 Running 0 3m4s kube-controller-manager-minikube 1/1 Running 0 3m4s kube-proxy-l29xr 1/1 Running 0 3m1s kube-scheduler-minikube 1/1 Running 0 3m4s storage-provisioner 1/1 Running 0 3m4s
How to create Ingress rules
At this point, the kubernetes-dashboard is not available externally.
$ kubectl get all -n kubernetes-dashboard NAME READY STATUS RESTARTS AGE pod/dashboard-metrics-scraper-dc6947fbf-rw5tv 1/1 Running 0 4m40s pod/kubernetes-dashboard-6dbb54fd95-k85gz 1/1 Running 0 4m40s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/dashboard-metrics-scraper ClusterIP 10.106.255.59 8000/TCP 4m40s service/kubernetes-dashboard ClusterIP 10.107.136.213 80/TCP 4m40s NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/dashboard-metrics-scraper 1/1 1 1 4m41s deployment.apps/kubernetes-dashboard 1/1 1 1 4m41s NAME DESIRED CURRENT READY AGE replicaset.apps/dashboard-metrics-scraper-dc6947fbf 1 1 1 4m41s replicaset.apps/kubernetes-dashboard-6dbb54fd95 1 1 1 4m41s
In other words, we do not have access to any about the kubernetes-dashboard unless we execute this command:
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml namespace/kubernetes-dashboard configured serviceaccount/kubernetes-dashboard configured service/kubernetes-dashboard configured secret/kubernetes-dashboard-certs configured secret/kubernetes-dashboard-csrf configured Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply secret/kubernetes-dashboard-key-holder configured configmap/kubernetes-dashboard-settings configured role.rbac.authorization.k8s.io/kubernetes-dashboard configured clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard configured rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard configured The ClusterRoleBinding "kubernetes-dashboard" is invalid: roleRef: Invalid value: rbac.RoleRef{APIGroup:"rbac.authorization.k8s.io", Kind:"ClusterRole", Name:"kubernetes-dashboard"}: cannot change roleRef
The output of the kubectl get all -n kubernetes-dashboard lets us know that the pod and service for the Dashboard are up and running. So, it is time to set up Ingress rules to access it via the hostname.
Before that, we have to take a look at the dashboard-ingress.yaml:
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: dashboard-ingress namespace: kubernetes-dashboard spec: rules: - host: dashboard.info http: paths: - pathType: Prefix path: "/" backend: service: name: kubernetes-dashboard port: number: 80
This tells us that the rules are currently forwarding every request in regards to dashboard.info to the internal kubernetes-dashboard service.
Hence, we create the ingress rules as seen below:
$ kubectl apply -f dashboard-ingress.yaml ingress.networking.k8s.io/dashboard-ingress created $ kubectl get ingress -n kubernetes-dashboard NAME CLASS HOSTS ADDRESS PORTS AGE dashboard-ingress dashboard.info 192.168.64.7 80 108s
Our Support Engineers recommend adding the information to /etc/hosts:
192.168.64.7 dashboard.info
After this is set up, any future requests from the Minikube cluster are taken over by the Ingress controller. It then follows through with the rules and ultimately forwards the requests to the kubernetes-dashboard.
Now, head to the browser and enter the domain name, dashboard.info to see a screen similar to the one below:
In case none of the paths or hosts match the HTTP request in the Ingress rules, the traffic heads to the default backend. For instance, the “404 page not found” response if the path is not present in any of the Ingress objects.
[Looking for a solution to another query? We are just a click away.]
Conclusion
In brief, our skilled Support Engineers at Bobcares demonstrated how to set up Nginx Ingress Controller for Dashboard service on Minikube.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments