502 Bad gateway: Hazelcast Management Center via GCE Ingress

オープン
#331 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
gcp, kubernetes

調査の方向性

インラインの Kubernetes YAML から始め、GCE Ingress の背後にある Management Center deployment を再現し、readiness response と ingress backend health を確認します。サービスが GCE Ingress に受け入れられる health check を公開し、リダイレクトに依存せずに backend が healthy と報告されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

For those of you who will be exposing Hazelcast Management Center (MC) via Google's Ingress GCE controller - be aware that GCE Ingress is expecting a working (should be 200 OK) readiness probe from the Service backing the MC Deployment.

I tried with the defaults and got 502 Bad gateway when accessing the exposed MC service. You can read about similar experience here.

Note also, that the default endpoint /hazelcast-mancenter returns 302 Found, which is ok for the readiness probe, but apparently not for GCE Ingress. The quick hack would be to use either /hazelcast-mancenter/index.html or /hazelcast-mancenter/. But in the long term I would propose to implement a dedicated health probe, e.g. /health or /healthz, etc.

So 302 Found is ok for checking the readiness of the Service, but if you check the status of the ingress, you will probably see the UNHEALTHY status:

k describe ing mc-ingress
Name:             mc-ingress
Namespace:        default
Address:          34.98.YYY.2
Default backend:  mc-service:8080 (10.52.2.23:8080)
Rules:
  Host  Path  Backends
  ----  ----  --------
  *     *     mc-service:8080 (10.52.2.23:8080)
Annotations:  
  ingress.kubernetes.io/backends:  {"k8s-be-32517--47d3253409234a5d":"UNHEALTHY"}
Events:                            <none>

Here is a working yaml:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mc-volume
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mc
  labels:
    app: hazelcast
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hazelcast
  template:
    metadata:
      labels:
        app: hazelcast
    spec:
      containers:
        - name: mc
          image: hazelcast/management-center
          resources:
            limits:
              memory: 1Gi
          ports:
            - containerPort: 8080
          livenessProbe:
            httpGet:
              path: /hazelcast-mancenter/
              port: 8080
          readinessProbe:
            httpGet:
              path: /hazelcast-mancenter/
              port: 8080
          volumeMounts:
            - name: mc-storage
              mountPath: /data
      volumes:
        - name: mc-storage
          persistentVolumeClaim:
            claimName: mc-volume
---
apiVersion: v1
kind: Service
metadata:
  name: mc-service
spec:
  type: NodePort
  selector:
    app: hazelcast
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: mc-ingress
  labels:
    app: hazelcast
spec:
  backend:
    serviceName: mc-service
    servicePort: 8080

P.S. Nginx Ingress doesn't have such issue. But a dedicated health endpoint is a nice to have non the less.

主要言語
Java
スター
558
フォーク
599
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hazelcast/hazelcast-code-samples のほかの issue

hazelcast/hazelcast-code-samples の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。