简体   繁体   English

Google Cloud kubernetes负载平衡器,后端的运行状况检查不起作用

[英]Google cloud kubernetes load balancer, health check on the backend isn't working

I am duplicating a Kubernetes cluster containing divolte from one GCP (Google Cloud Platform) project to another. 我正在将一个包含Divolte的Kubernetes集群从一个GCP(Google Cloud Platform)项目复制到另一个项目。 I have the exact same configurations in the already running project as the target project. 在已经运行的项目中,我与目标项目具有完全相同的配置。 In my new project I don't get load balancer running with the right health check and when I try to connect to te static IP form the load balancer I get a 502 server error. 在我的新项目中,我没有使用正确的运行状况检查来运行负载平衡器,并且当我尝试从负载平衡器连接到静态IP时,出现了502服务器错误。

I've followed the same steps as in the original project: 我遵循与原始项目相同的步骤:

  1. Creating a cluster on GCP 在GCP上创建集群
  2. Authorize local kubectl to the cluster on GCP 向GCP上的集群授权本地Kubectl
  3. Add TLS secret to kubernetes cluster on GCP 将TLS密钥添加到GCP上的kubernetes集群
  4. Create static global IP 创建静态全局IP
  5. build the docker file with divolte 用divolte构建docker文件
  6. push the docker file to eu.gcr.io/project-name 将Docker文件推送到eu.gcr.io/project-name
  7. apply the deployment, ingress and service file 应用部署,入口和服务文件

Deployment file: 部署文件:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: divolte
spec:
  selector:
    matchLabels:
      app: divolte
  replicas: 2
  strategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: divolte
    spec:
      containers:
      - name: divolte
        imagePullPolicy: Always
        image: "eu.gcr.io/project-name/divolte-collector:latest"
        ports:
        - containerPort: 8290
        env:
        - name: JAVA_OPTS
          value: "-Xms512m -Xmx2048m -XX:+UseG1GC -Djava.awt.headless=true"
        resources:
          limits:
            cpu: 1
            memory: 3072Mi
          requests:
            cpu: 1
            memory: 2048Mi
        livenessProbe:
          httpGet:
            path: /divolte.js
            port: 8290
          initialDelaySeconds: 22
          timeoutSeconds: 1
        readinessProbe:
          httpGet:
            path: /ping
            port: 8290
          initialDelaySeconds: 22
          periodSeconds: 1
      terminationGracePeriodSeconds: 30

Service file: 服务文件:

apiVersion: v1
kind: Service
metadata:
  name: divolte
spec:
  ports:
  - name: http
    port: 80
    targetPort: 8290
    nodePort: 30964
  selector:
    app: divolte
  type: NodePort

Ingress file: 入口文件:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: divolte
  annotations:
    kubernetes.io/ingress.global-static-ip-name: ip-name-here
spec:
  tls:
  - secretName: ssl-cert-name-here
  backend:
    serviceName: divolte
    servicePort: 80

I expected that the load balancer would pick up the configuration file as in my previous GCP project and would reroute the traffic to the cluster correctly, but I cannot get my GCP load balancer with the health check to work. 我希望负载平衡器能够像我以前的GCP项目一样拾取配置文件,并将流量正确地重新路由到群集,但是我无法通过运行状况检查使GCP负载平衡器正常工作。 Any ideas what to do next? 任何想法下一步该怎么做?

I have found the solution to the problem. 我已经找到解决问题的方法。

Thanks for the suggestions, I was looking to a sympton in the load balancer, but it was the wrong direction. 感谢您的建议,我一直在寻找负载均衡器中的症状,但这是错误的方向。

The kubernetes pods were stuck in a "crashloopbackoff" because I forgot to create a Google Storage bucket, it wasn't in my documentation to setup the environment so I overlooked it. kubernetes吊舱卡在“ crashloopbackoff”中,因为我忘了创建Google存储桶,但我的文档中没有设置环境,因此我忽略了它。 I found it with the "kubectl logs" command. 我用“ kubectl日志”命令找到了它。 The app is up and running now. 该应用程序已启动并正在运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Cloud 未在负载均衡器运行状况检查中应用 BackendConfig - Google Cloud not Applying the BackendConfig on the Load Balancer Health Check kubernetes 健康检查作业进入谷歌云平台 - kubernetes health check job into google cloud platform 无负载平衡器的Google Cloud Kubernetes - Google Cloud Kubernetes w/o load balancer Google Cloud Load Balancing运行状况检查重置 - Google Cloud Load Balancing health check reset 检查 Kubernetes 中的负载均衡器 - Check Load Balancer in Kubernetes Kubernetes UDP服务未与Google Cloud Load Balancer一起运行 - Kubernetes UDP service not running with Google Cloud Load balancer Google Cloud HTTP(S) 负载平衡器不会取消与后端的连接 - Google Cloud HTTP(S) load balancer does not cancel connection with backend 缓慢的静态IP分配给Google Cloud Platform上的Kubernetes Load Balancer - Slow static IP assignment to Kubernetes Load Balancer on Google Cloud Platform 在Google Cloud Platform上将HTTP负载均衡器与Kubernetes结合使用 - Using HTTP Load Balancer with Kubernetes on Google Cloud Platform 在Google Cloud Platform上不允许使用Django,Kubernetes和负载均衡器的主机 - Disallowed host with Django, Kubernetes and a Load Balancer on Google Cloud Platform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM