0

I have an nginx ingress controller and ingress resource for hazlecast running with path /hazlecast-mancenter mapped to hazlecast-mancenter in the backend. When I try to hit "http://hostname/hazlecast-mancenter" the page doesn't come up . When i check the logs in deployment of ingress controller i get the following logs

192.168.3.193 - - [10/Jun/2022:16:52:58 +0000] "GET /favicon.ico HTTP/2.0" 302 0 "https://james.new-dev.com/hazelcast-mancenter/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537 

Not sure why it is redirecting it here.

Below are the manifests for ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    meta.helm.sh/release-name: hazelcast
    meta.helm.sh/release-namespace: default
    nginx.ingress.kubernetes.io/add-base-url: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /$1
  creationTimestamp: "2022-06-10T14:18:37Z"
  generation: 6
  labels:
    app.kubernetes.io/instance: hazelcast
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: hazelcast-mancenter
    helm.sh/chart: hazelcast-5.4.1
  name: hazelcast-mancenter
  namespace: default
  resourceVersion: "4041983"
  uid: 36921da3-0757-47c1-9d88-1a87490393df
spec:
  rules:
 - host: james.new-dev.com
    http:
      paths:
      - backend:
          service:
            name: hazelcast-mancenter
            port:
              number: 8080
        path: /hazelcast-mancenter
        pathType: Prefix
  tls:
 - secretName: new-dev-tls

Deployment

kubectl describe sts hazelcast-mancenter
Name:               hazelcast-mancenter
Namespace:          default
CreationTimestamp:  Fri, 10 Jun 2022 14:18:37 +0000
Selector:           app.kubernetes.io/instance=hazelcast,app.kubernetes.io/name=hazelcast-mancenter,role=mancenter
Labels:             app.kubernetes.io/instance=hazelcast
                    app.kubernetes.io/managed-by=Helm
                    app.kubernetes.io/name=hazelcast-mancenter
                    helm.sh/chart=hazelcast-5.4.1
Annotations:        meta.helm.sh/release-name: hazelcast
                    meta.helm.sh/release-namespace: default
Replicas:           1 desired | 1 total
Update Strategy:    RollingUpdate
  Partition:        0
Pods Status:        1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:           app.kubernetes.io/instance=hazelcast
                    app.kubernetes.io/managed-by=Helm
                    app.kubernetes.io/name=hazelcast-mancenter
                    helm.sh/chart=hazelcast-5.4.1
                    role=mancenter
  Service Account:  hazelcast
  Containers:
   hazelcast-mancenter:
    Image:      hazelcast/management-center:5.1.2
    Port:       8080/TCP
    Host Port:  0/TCP
    Liveness:   http-get http://:8081/health delay=30s timeout=5s period=10s #success=1 #failure=3
    Readiness:  tcp-socket :8080 delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      MC_INIT_CMD:  ./bin/mc-conf.sh cluster add --lenient=true -H /data -cc /config/hazelcast-client.yaml;
      JAVA_OPTS:     -Dhazelcast.mc.healthCheck.enable=true -DserviceName=hazelcast -Dnamespace=default -Dhazelcast.mc.tls.enabled=false
    Mounts:
      /config from config (rw)
      /data from mancenter-storage (rw)
  Volumes:
   config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      hazelcast-mancenter-configuration
    Optional:  false
   mancenter-storage:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
Volume Claims:
  Name:          mancenter-storage
  StorageClass:
  Labels:        app.kubernetes.io/instance=hazelcast
                 app.kubernetes.io/managed-by=Helm
                 app.kubernetes.io/name=hazelcast-mancenter
                 helm.sh/chart=hazelcast-5.4.1
  Annotations:   <none>
  Capacity:      8Gi
  Access Modes:  [ReadWriteOnce]
Events:          <none>

Service

kubectl describe svc hazelcast-mancenter
Name:              hazelcast-mancenter
Namespace:         default
Labels:            app.kubernetes.io/instance=hazelcast
                   app.kubernetes.io/managed-by=Helm
                   app.kubernetes.io/name=hazelcast-mancenter
                   helm.sh/chart=hazelcast-5.4.1
Annotations:       meta.helm.sh/release-name: hazelcast
                   meta.helm.sh/release-namespace: default
Selector:          app.kubernetes.io/instance=hazelcast,app.kubernetes.io/name=hazelcast-mancenter,role=mancenter
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.100.125.152
IPs:               10.100.125.152
Port:              http  8080/TCP
TargetPort:        mancenter/TCP
Endpoints:         192.168.1.190:8080
Port:              https  443/TCP
TargetPort:        mancenter/TCP
Endpoints:         192.168.1.190:8080
Session Affinity:  None
Events:            <none>

I have mapped the ingress port with svc and target port, not sure why the redirect 302 code is thrown

When i do a inspect of the url when hit i get 302 redirected , below are some snapshots that i am pasting

enter image description here

enter image description here

Shane Warne
  • 1,350
  • 11
  • 24
  • What happens if you try to go at your desired address but https? Like `https://james.new-dev.com/hazelcast-mancenter` or whichever is the desired Hostname? – AndD Jun 10 '22 at 17:17
  • Hey @AndD, nothing comes up. blank page . when doing an inspect , there are 302 status codes – Shane Warne Jun 10 '22 at 17:44
  • I noticed you have a rewrite-target in your Ingress, do you want to remove the hazelcast-mancenter part of the url? – AndD Jun 10 '22 at 18:39
  • No , i dont want to remove the hazelcast-mancenter part. i tried it without rewrite as well though. – Shane Warne Jun 10 '22 at 18:43
  • @AndD i have pasted the pics of inspect for your reference, any pointers will be helpful. – Shane Warne Jun 11 '22 at 15:35
  • What is the full URL of the requests being redirected? Do they request something at the root of the domain? – AndD Jun 12 '22 at 05:41
  • Full url is https://james.new-dev.com/hazelcast-mancenter for this ingress object. At the root https://james.new-dev.com/ there is another ingress object that has a backend to a service , I feel it is going there whenever i hit https://james.new-dev.com/hazelcast-mancenter @AndD – Shane Warne Jun 13 '22 at 18:47

0 Answers0