Opensearch cluster is not working with ingress

381 views Asked by At

I have opensearch helm chart and deployed the opensearch wherein it has created k8 pod. Currently I am using port forwarding to connect to opensearch cluster and I am using below command to connect to my opensearch cluster after doing port forwarding.

curl -s -XGET https://<host_ip>:9200/ -u admin:admin --insecure

Using above command I am able to connect to opensearch cluster. However, instead of port forwarding we want to use nginx ingress to connect to opensearch cluster. So, I have installed nginx ingress controller then I have deployed ingress and is the definition for the same.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: osc-nginx-ingress
  namespace: osc
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "75s"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "300s"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "300s"
spec:
  ingressClassName: nginx
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: opensearch-cluster-master
                port: 
                  number: 9200

Below is the status of opensearch pods.

NAME                          READY   STATUS    RESTARTS   AGE
opensearch-cluster-master-0   1/1     Running   0          13h
opensearch-cluster-master-1   1/1     Running   0          13h
opensearch-cluster-master-2   1/1     Running   0          13h

Below is my ingress which got created from the above ingress definition.

Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
NAME               CLASS   HOSTS   ADDRESS   PORTS   AGE
os-nginx-ingress   nginx   *                 80      13h

Checked ingress logs using kubectl describe command and I am just seeing below error and I believe we can ignore this error.

Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
Name:             os-nginx-ingress
Namespace:        os
Address:
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host        Path  Backends
  ----        ----  --------
  *
              /   opensearch-cluster-master:9200 (10.24.1.106:9200,10.24.1.107:9200,10.24.1.105:9200)
Annotations:  nginx.ingress.kubernetes.io/proxy-connect-timeout: 75s
              nginx.ingress.kubernetes.io/proxy-read-timeout: 300s
              nginx.ingress.kubernetes.io/proxy-send-timeout: 300s
              nginx.ingress.kubernetes.io/rewrite-target: /
Events:       <none>

Below is the ingress controller pod.

NAME                                             READY   STATUS      RESTARTS   AGE
nginx-ingress-controller-sjtw6                   1/1     Running     0          4d21h

Not sure why ingress is not working. Could you please assist me here?

0

There are 0 answers