小编Mik*_*ike的帖子

更新的运行状况检查会导致App Engine部署失败?

我们使用更新了google app引擎运行状况检查,从旧版本更新为新版本,现在部署失败。项目上的其他所有内容都没有改变。我们测试了默认设置,然后进行了扩展检查,以防万一。

这是错误: ERROR: (gcloud.app.deploy) Error Response: [4] Your deployment has failed to become healthy in the allotted time and therefore was rolled back. If you believe this was an error, try adjusting the 'app_start_timeout_sec' setting in the 'readiness_check' section.

这是我们的app.yaml:

liveness_check:
   check_interval_sec: 120
   timeout_sec: 40
   failure_threshold: 5
   success_threshold: 5
   initial_delay_sec: 500

readiness_check:
  check_interval_sec: 120
  timeout_sec: 40
  failure_threshold: 5
  success_threshold: 5
  app_start_timeout_sec: 1500
Run Code Online (Sandbox Code Playgroud)

不幸的是,无论配置如何,准备情况检查和活动检查都抛出404。

是什么原因引起的?以及如何调试呢?是否可以回滚到旧的健康检查?

google-app-engine google-cloud-platform

10
推荐指数
2
解决办法
6664
查看次数

GKE内部负载均衡器无法创建

我有一个gke集群,它有一个http(s)负载均衡器,它根据文档使用RATE平衡模式.

我正在尝试使用内部负载均衡器将此群集上的工作负载暴露给App Engine.两种服务都位于同一区域的同一网络中.

但是,当我尝试创建负载均衡器时,它会因此错误而失败.

Error creating load balancer (will retry): failed to ensure load balancer for service default/internal-es-lb: googleapi: Error 400: Validation failed for instance 'projects/PROJECT-NAME/zones/us-central1-a/instances/gke-staging-default-pool-85830c52-g6tg': instance may belong to at most one load-balanced instance group., instanceInMultipleLoadBalancedIgs

有几件事情很奇怪.
1.内部LB今天早些时候工作.
2. http(s)负载均衡器抛出与内部LB相同的错误,即使它是集群
3 上唯一的负载均衡器.当我使用我的服务yaml创建LB时,它会创建一个新的/不同的实例组比我的目标池

这是我的服务yaml:

apiVersion: v1
kind: Service
metadata:
  name: internal-es-lb
  annotations:
    cloud.google.com/load-balancer-type: "Internal"
  labels:
    app: internal-es-lb
spec:
  type: LoadBalancer
  loadBalancerIP: 10.128.0.4
  loadBalancerSourceRanges: [0.0.0.0/0]
  ports:
    - port: 80
      targetPort: 9200
      protocol: TCP
      name: http-es-lb
  selector:
    app: …
Run Code Online (Sandbox Code Playgroud)

google-app-engine google-compute-engine google-cloud-platform google-kubernetes-engine

8
推荐指数
1
解决办法
426
查看次数

GCP负载平衡器后端状态未知

我很惊讶

我有一个演出和制作环境。两种环境具有相同的部署,服务,入口,防火墙规则,并且都在200上使用/

但是,在打开暂存环境并设置相同的入口后,暂存服务将失败 Some backend services are in UNKNOWN state。生产仍在进行中。

前端和后端Pod都可以在GKE上使用。我已经手动测试了健康检查,当我拜访时这些检查通过了/

我看不到指向正确方向的日志或gcp文档。我可能会打破什么?

ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: fanout-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: "STATIC-IP"
spec:
  backend:
    serviceName: frontend
    servicePort: 8080
  tls:
  - hosts:
    - <DOMAIN>
    secretName: staging-tls
  rules:
  - host: <DOMAIN>
    http:
      paths:
      - path: /*
        backend:
          serviceName: frontend
          servicePort: 8080
      - path: /backend/*
        backend:
          serviceName: backend
          servicePort: 8080
Run Code Online (Sandbox Code Playgroud)

frontend.yaml

apiVersion: v1
kind: Service
metadata:
  labels:
    app: frontend
  name: frontend
  namespace: default …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform kubernetes google-kubernetes-engine

8
推荐指数
2
解决办法
3768
查看次数

使用 gcloud 停止当前版本的应用引擎的推荐方法是什么?

我想通过运行 bash 脚本来自动启动/停止我们的应用引擎服务。

我知道它很容易运行gcloud app versions start/stop,但我不想手动检查版本号。我想将提供 100% 流量的版本动态传递给 gcloud 并告诉它停止。

另一方面,我还想告诉 gcloud 启动最近部署的版本。

推荐的方法是什么?

谢谢!

google-app-engine gcloud

6
推荐指数
1
解决办法
2989
查看次数

如何使用 Google Cloud Armor 将 GKE 上的少数 IP 列入白名单?

我们正在尝试阻止除基于此 Cloud Armor演练的一些外部 IP 地址之外的所有非集群流量。

GKE 集群识别了规则,但仍然阻止允许的 IP。以下是遵循的步骤:

1)创建策略+规则

gcloud beta compute security-policies create allow-team-only \
    --description "Cloud Armor deny non-team IPs"


gcloud beta compute security-policies rules create 1000 \
    --security-policy allow-team-only \
    --description "Deny traffic from 0.0.0.0/0." \
    --src-ip-ranges "0.0.0.0/0" \
    --action "deny-404"


gcloud beta compute security-policies rules create 999 \
    --security-policy allow-team-only \
    --description "Allow traffic from <IP ADDRESS>." \
    --src-ip-ranges "<IP ADDRESS>/32" \
    --action "allow"    
Run Code Online (Sandbox Code Playgroud)

2) 将规则应用到我们位于 8080 端口的服务

metadata:
  annotations:
    beta.cloud.google.com/backend-config: '{"ports": {"8080":"allow-team-only"}}'  
Run Code Online (Sandbox Code Playgroud)

我在忽略什么?

谢谢!

google-cloud-platform google-kubernetes-engine google-cloud-networking google-cloud-armor

6
推荐指数
2
解决办法
7375
查看次数

奇怪的 Next.js TTFB 问题

我们在 Docker 中运行 Next.js。

在本地构建镜像并使用生产后端时,TTFB 几乎为零,但是当我们部署此镜像时,TTFB 在某些情况下可能长达 30 秒。

生产服务器是不需要启动的暖服务器。

我运行了四项测试,以使用相同的生产后端针对相同的路线测量 TTFB。

  1. 使用 docker 在本地处于生产模式
  2. 在本地处于生产模式 yarn build && yarn start
  3. 本地在开发模式下 yarn run dev
  4. 生产中

在 docker 内外测试生产模式时,TTFB 接近于零。

在开发模式下本地测试时,TTFB 几乎与生产相同。

我已经通过 SSH 进入生产环境并确认没有安装开发包,所以我认为我们不可能在开发模式下运行。

我希望生产 TTFB 更接近我们在当地所经历的。

什么可能导致本地和生产之间的差异?

文件

FROM node:10.13.0-alpine

WORKDIR /app

EXPOSE 8080

CMD [ "yarn", "start" ]

COPY . .

RUN yarn install

RUN yarn build
Run Code Online (Sandbox Code Playgroud)

server.js 片段

const express = require('express');
const next = require('next');
const cookieParser = require('cookie-parser');
const jwtDecode = require('jwt-decode');
const { …
Run Code Online (Sandbox Code Playgroud)

reactjs server-side-rendering next.js

6
推荐指数
1
解决办法
1200
查看次数

从App Engine连接到kubernetes引擎

我们想使用一个应用引擎灵活的过程来更新我们的ElasticSearch索引,该索引位于Google Kubernetes Engine上。我们需要通过一个http地址连接到ElasticSearch。推荐的方法是什么?我们不想将集群暴露给外部网络,因为我们前面没有身份验证。

我看过这样的帖子,但是自问/答以来的两年中,k8和AE都发生了很大变化。

谢谢你的帮助!

google-app-engine elasticsearch kubernetes google-kubernetes-engine

5
推荐指数
1
解决办法
405
查看次数

如何在 Kubernetes 上的 Elasticsearch 中禁用交换?

根据官方 es 文档,禁用交换是 Elasticsearch 可用的最佳性能提升之一。

然而,事实证明它很难配置。我花了很多时间研究并尝试不同的方法来使用 Kubernetes 上的官方 ES docker 镜像来禁用交换。

设置bootstrap.memory_lock: true为环境变量时,映像无法启动并出现错误:Unable to lock JVM Memory: error=12, reason=Cannot allocate memory. This can result in part of the JVM being swapped out. Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536。正如文档所指出的,这是预料之中的。我什至已经安装了自定义设置/etc/security/limits.conf,但失败了。

在 k8s 上使用官方 es 镜像时,建议禁用交换的方法是什么?

而且,这是我的 yaml 的相关部分

apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: elastic-data
spec:
  serviceName: elastic-data
  replicas: 1
  template:
    spec:
      securityContext:
        runAsUser: 0
        fsGroup: 0
      containers:
      - name: elastic-data
        image: …
Run Code Online (Sandbox Code Playgroud)

elasticsearch kubernetes google-kubernetes-engine

5
推荐指数
1
解决办法
3006
查看次数

如何在多个开发环境中使用GAE的dispatch.yaml?

我正在尝试了解dispatch.yamlGoogle App Engine 的文件。

我们有一个带有前端和后端的香草Web应用程序。我们也有开发和生产环境。两种环境在GAE上都有两项服务- frontenddefault,这是后端。

我们有一个带有前端和后端的香草Web应用程序。我们也有开发和生产环境。我们在GAE上提供两项服务-前端和默认(后端)。我们在GAE上有两个项目- staging,这是我们的开发环境,而production,是我们的生产环境。暂存环境是从前端和后端的dev分支构建的。生产环境是由前端和后端的主人构建的。

我们想在登台和生产环境中使用自定义路线。

我尝试使用dispatch_staging.yamldispatch_prod.yaml区分文件,但GAE无法识别这些文件名。我猜我们可以重命名前端服务,但是看起来好像没有办法解决default

您如何使用它dispatch.yaml来指定要构建的环境?

google-app-engine google-cloud-platform app-engine-flexible

3
推荐指数
2
解决办法
1237
查看次数

chown: /var/lib/postgresql/data/postgresql.conf:只读文件系统

/var/lib/postgresql/data我通过遵循此答案解决了安装时的权限问题initContainers

现在我尝试postgresql.conf作为卷安装,并且遇到了类似的权限问题,抛出chown: /var/lib/postgresql/data/postgresql.conf: Read-only file system.

我可能会错过什么?我尝试了很多不同的变体,但运气不佳。

apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: postgres
  labels:
    app: postgres
spec:
  serviceName: postgres
  replicas: 1
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: postgres
    spec:
      terminationGracePeriodSeconds: 10
      initContainers:
      - name: chmod-er
        image: busybox:latest
        command:
        - /bin/chown
        - -R
        - '0'
        - /var/lib/postgresql/data
        volumeMounts:
        - name: postgredb
          mountPath: /var/lib/postgresql/data
        - name: pg-config
          mountPath: /var/lib/postgresql/data/postgresql.conf
          subPath: postgresql.conf
      containers:
        - name: postgres
          image: mdillon/postgis:10-alpine
          ports:
            - containerPort: 5432 …
Run Code Online (Sandbox Code Playgroud)

postgresql kubernetes google-kubernetes-engine

1
推荐指数
1
解决办法
5852
查看次数