externally access the application using hostname/subdomain in ingress resource

11/18/2019

Need to access the application from external using Ingress hostname/sub-domain for the application that is specified in the below code. eg. test-app.dev-cluster-poc.company.domain.

cat app-ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  namespace: ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: app-ingress
spec:
  rules:
  - host: test-app.dev-cluster-poc.company.domain
    http:
      paths:
      - backend:
          serviceName: appsvc1
          servicePort: 80
        path: /app1
      - backend:
          serviceName: appsvc2
          servicePort: 80
        path: /app2

While troubleshooting using steps in the url, I found that there is no ADDRESS in the "kubectl get ingress" output. expecting an ip address like below.

enter image description here

but, I am seeing like below, 3rd column is empty. enter image description here

what are the necessary configuration required to externally access the application like registering the hostname(test-app.dev-cluster-poc.company.domain) or adding A-record or running any dns service in the kubernetes cluster.

what is causing the ADDRESS column empty in "kubectl get ingress" command.

[EDIT]

apiVersion: v1
kind: Service
metadata:
  name: appsvc1
  namespace: ingress
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: app1

Nginx controller service like below.

cat nginx-ingress-controller-service.yaml 
apiVersion: v1
kind: Service
metadata:
  name: nginx-ingress
  namespace: ingress
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30000
      name: http
    - port: 18080
      nodePort: 32000
      name: http-mgmt
  selector:
    app: nginx-ingress-lb
-- arunp
kube-dns
kubernetes
kubernetes-ingress
nginx-ingress

0 Answers