skip to Main Content

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

2

Answers


  1. 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.
    Login or Signup to reply.
    1. Make sure you have an ingress controller deployed. This is a load balancer service which can have either a public or private ip depending on your situation.

    2. Make sure you have an ingress definition which has a rule to point to your service. This is the metadata which will tell your ingress controller how to route requests to its ip address. These routing rules can contain how to handle paths like strip, exact, etc….

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search