503 Service Temporarily Unavailable Nginx + Kibana + AKS

3/6/2020

I have deployed Kibana in AKS with the server.basepath of /logs since I want it to be deployed in subpath. I am trying to access Kibana service using nginx controller It is giving 503 service unavailable but Service/Pod is running. Please help me on this.

Kibana Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kibana
  namespace: kube-logging
  labels:
    app.kubernetes.io/name: kibana
    helm.sh/chart: kibana-0.1.0
    app.kubernetes.io/instance: icy-coral
    app.kubernetes.io/managed-by: Tiller
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: kibana
      app.kubernetes.io/instance: icy-coral
  template:
    metadata:
      labels:
        app.kubernetes.io/name: kibana
        app.kubernetes.io/instance: icy-coral
    spec:
      containers:
        - name: kibana
          image: "docker.elastic.co/kibana/kibana:7.6.0"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 5601
              protocol: TCP
          env:
            - name: ELASTICSEARCH_URL
              value: http://elasticsearch:9200
            - name: SERVER_BASEPATH
              value: /logs
            - name: SERVER_REWRITEBASEPATH
              value: "true"
          resources:
            limits:
              cpu: 1000m
            requests:
              cpu: 100m

Kibana service:

apiVersion: v1
kind: Service
metadata:
  name: kibana
  namespace: kube-logging
  labels:
    app.kubernetes.io/name: kibana
    helm.sh/chart: kibana-0.1.0
    app.kubernetes.io/instance: icy-coral
    app.kubernetes.io/managed-by: Tiller
spec:
  type: ClusterIP
  ports:
    - port: 80
      targetPort: 5601
      protocol: TCP
      name: http
  selector:
    app.kubernetes.io/name: kibana
    app.kubernetes.io/instance: icy-coral

Kibana Ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kibana
  labels:
    app.kubernetes.io/name: kibana
    helm.sh/chart: kibana-0.1.0
    app.kubernetes.io/instance: icy-coral
    app.kubernetes.io/managed-by: Tiller
  annotations:
    ingress.kubernetes.io/send-timeout: "600"
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/ssl-redirect: "false"

spec:
  rules:
    - host: ""
      http:
        paths:
          - path: /logs/?(.*)
            backend:
              serviceName: kibana
              servicePort: 80
-- Seenu
azure-aks
kibana-7
kubernetes
nginx-ingress

1 Answer

3/6/2020

Ensure kibana is running with:

kubectl logs kibana

Check the endpoint for the service is not empty:

kubectl describe svc kibana

Check the ingress is correctly configured:

kubectl describe ingress kibana

check the ingress-controller logs:

kubectl logs -n nginx-ingress-controller-.....

Update:

You can only refer services on the same namespace of the ingress. So try to move ingress to kube-logging namespace.

Checkout this: https://github.com/kubernetes/kubernetes/issues/17088

-- TlmaK0
Source: StackOverflow