Exposing AKS cluster application using ingress

Viewed 16

I am trying to expose my application inside the AKS cluster using ingress: It creates a service and an ingress but somehow does not assign an address to the ingress. What could be a possible reason for this?

apiVersion: apps/v1 kind: Deployment metadata: name: dockerdemo spec: replicas: 1 selector: matchLabels: app: dockerdemo template: metadata: labels: app: dockerdemo spec: nodeSelector: "kubernetes.io/os": linux containers: - name: dockerdemo image: devsecopsacademy/dockerapp:v3 env: - name: ALLOW_EMPTY_PASSWORD value: "yes" resources: requests: cpu: 100m memory: 128Mi limits: cpu: 250m memory: 256Mi ports: - containerPort: 80 name: redis

apiVersion: v1 kind: Service metadata: name: dockerdemo-service spec: type: ClusterIP ports:

  • port: 80 selector: app: dockerdemo

apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: my-ingress15 annotations: kubernetes.io/ingress.class: addon-http-application-rounting spec: rules:

  • host: curefirsttestapp.cluster15-dns-c42b65ee.hcp.westeurope.azmk8s.io http: paths:
    • path: / pathType: Prefix
      backend: service: name: dockerdemo-service port: number: 80
1 Answers

Well, first make sure your application is up and functionning inside your K8s Cluster using a port-forword to your localhost

kubectl -n $NAMESPACE port-forward svc/$SERVICE :$PORT

if app is reachable and your call are getting back 200 Status, you can now move to the ingress part:

  1. Make sure ingress controller is well installed under your services
kubectl -n $NAMESPACE get svc
  1. Add a DNS record in your DNS zone which maps your domain.com to ingress controller $EXTERNAL_IP

  2. Take a look at the ingress you created for your $SERVICE

kubectl -n $NAMESPACE get ingress
  1. At this stage, if you application is well running and also the the ingress is well set, the app should be reachable trough domain.com, otherwise we'll need further debugging.
Related