0
votes

I am trying to expose kubernetes-dashboard app externally using Ingress resource. I have installed Nginx Controller and a service called Kubernetes-dashboard is clusterIP type service with port 443.

I have created Ingress resource with YAML file and pointing to backend service which is kubernetes-dashboard but somehow I am not getting the IP address of my host (dashboard.com) so that I can add this entry in /etc/hosts file. what is the resolution here. I am not able to paste the yaml file here as this website complain about code formatting.

I tried to put YAML file here in various ways but it does not work.

yaml file of kubernetes-dashboard as below: apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: dashboard-ingress namespace: kubernetes-dashboard spec: tls: - hosts: - dashboard.com secretName: kubernetes-dashboard-certs rules: - host: dashboard.com http: paths: - pathType: ImplementationSpecific path: / backend: service: name: kubernetes-dashboard port: number: 443

Kubernetes-dashboard service config as below: Name: kubernetes-dashboard Namespace: kubernetes-dashboard Labels: k8s-app=kubernetes-dashboard Annotations: Selector: k8s-app=kubernetes-dashboard Type: ClusterIP IP Family Policy: SingleStack IP Families: IPv4 IP: 10.106.1.186 IPs: 10.106.1.186 Port: 443/TCP TargetPort: 8443/TCP Endpoints: 10.44.0.3:8443 Session Affinity: None Events:

1
Welcome to stackoverflow, regarding copy pasting the YAML maybe you have no tried or read document before posting the question. All are posting code in stackoverflow not sure why you can't. meta.stackoverflow.com/questions/356678/…Harsh Manvar
I read the error message while I was pasting the code into this website but every time it complains some code formatting which does not make any sense to me. it is better to put with examples. I believe many people having issue with pasting the contents (code) in this website.Anil
@HarshManvar I have pasted the kubernetes-dashboard ingress yaml file and kubernetes-dashboard service config: I hope you are able to read it. It looks ugly thoughAnil
I wouldnt do it. I wouldnt even deploy it. Thats a big security no go.The Fool
@TheFool , this is not production env. this is just lab I am following along.Anil

1 Answers

0
votes

I am not getting the IP address of my host

You have to use the Nginx ingress controller service IP everywhere so traffic gets forwarded and managed via Nginx ingress.

you can check the IP of Nginx controller using the

Kubectl get svc -n ingress-nginx

Nginx controller service will be exposed as the type LoadBalancer you can use this IP into the DNS route as A or CNAME record.

Any request coming to your domain will get forwarded to

ingress > Nginx ingress controller > K8s service > K8s PODs