标签: autopilot

GCP Kubernetes Autopilot 是否支持零停机更新?

首先,我使用GCP k8s标准集群,效果很好。我对autopilot有点感兴趣,所以我尝试在 k8s autopilot 上部署相同的 pod。

问题是,在滚动更新 Pod 时,我遇到了许多 502 错误,这些更新是用 Go Gin 和 Python FastAPI(uvicorn) 实现的。Go 的 502 错误比 Python 少。

我怀疑 Service(ClusterIP) 在滚动更新期间能否正确切换 Pod 之间的流量。

同样,相同的应用程序在标准版本中运行良好,并且 Go 和 Python 中的 preStop、maxSurge 和正常关闭的实现如以下文档所述。是否有特定于Autopilot的设置?

https://cloud.google.com/kubernetes-engine/docs/how-to/container-native-load-balancing#traffic_does_not_reach_endpoints

google-cloud-platform kubernetes autopilot

5
推荐指数
0
解决办法
159
查看次数

如何使用 Envoy 和 gRPC-Web 配置 GKE Autopilot

我的本地计算机上运行一个应用程序,它使用 React -> gRPC-Web -> Envoy -> Go 应用程序,一切运行都没有问题。我正在尝试使用 GKE Autopilot 进行部署,但无法获得正确的配置。我对所有 GCP/GKE 都是新手,因此我正在寻求帮助以找出问题所在。

我最初关注的是这个文档,尽管我只有一个 gRPC 服务: https://cloud.google.com/architecture/exusing-grpc-services-on-gke-using-envoy-proxy

据我所知,GKE Autopilot 模式需要使用外部 HTTP(s) 负载平衡,而不是上述解决方案中所述的网络负载平衡,因此我一直在尝试使其发挥作用。经过各种尝试,我目前的策略有Ingress、BackendConfig、Service、Deployment。该部署包含三个容器:我的应用程序、用于转换 gRPC-Web 请求和响应的 Envoy sidecar,以及云 SQL 代理 sidecar。我最终想使用 TLS,但现在我将其排除在外,以免事情变得更加复杂。

当我应用所有配置时,后端服务显示一个区域中的一个后端,并且运行状况检查失败。健康检查设置为端口 8080 和路径 /healthz,这是我在部署配置中指定的内容,但我很怀疑,因为当我查看 envoy-sidecar 容器的详细信息时,它显示了 Readiness 探针如:http-get HTTP://:0/healthz headers=x-envoy-livenessprobe:healthz。“:0”只是意味着它使用容器的默认地址和端口,还是表明存在配置问题?

我一直在阅读各种文档,但无法将它们拼凑在一起。有没有一个例子可以说明如何做到这一点?我一直在寻找,但没有找到。

我当前的配置是:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: grammar-games-ingress
  #annotations:
    # If the class annotation is not specified it defaults to "gce".
    # kubernetes.io/ingress.class: "gce"
    # kubernetes.io/ingress.global-static-ip-name: <IP addr>
spec:
  defaultBackend:
    service:
      name: grammar-games-core
      port:
        number: 80
---
apiVersion: …
Run Code Online (Sandbox Code Playgroud)

google-kubernetes-engine grpc-web autopilot

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

无法将容器映像从私有 Artifact Registry 拉取到 GKE Autopilot,即使这些映像位于同一项目中

根据下面的文章,我们似乎可以将容器映像从 ArtifactRegistry 拉取到 GKE,而无需任何额外的身份验证(当它们位于同一项目中时)。

https://cloud.google.com/artifact-registry/docs/integrate-gke

https://www.youtube.com/watch?v=BfS7mvPA-og

GKE 出现错误:ImagePullBackOff 和错误:ErrImagePull 错误

但当我尝试时,我遇到了ImagePullBackOff错误。
有没有什么错误?误解?或者我应该使用其他身份验证吗?

复制

在https://console.cloud.google.com上的某些项目中使用 Google Cloud Shell 很方便。

创建工件注册表

gcloud artifacts repositories create test \
    --repository-format=docker \
    --location=asia-northeast2
Run Code Online (Sandbox Code Playgroud)

推送样本图片

gcloud auth configure-docker asia-northeast2-docker.pkg.dev
docker pull nginx
docker tag nginx asia-northeast2-docker.pkg.dev/${PROJECT_NAME}/test/sample-nginx-image
docker push asia-northeast2-docker.pkg.dev/${PROJECT_NAME}/test/sample-nginx-image
Run Code Online (Sandbox Code Playgroud)

创建 GKE Autopilot 集群

使用 GUI 控制台创建 GKE Autopilot 集群。

几乎所有选项都是默认的,但我更改了这两个。

  • 将集群名称设置为 test。
  • 设置与注册表相同的区域。(在本例中为 asia-northeast2)
  • 启用 Anthos Service Mesh。

将容器映像从 Artifact Registry 部署到 GKE

gcloud container clusters get-credentials test --zone asia-northeast2
kubectl run test …
Run Code Online (Sandbox Code Playgroud)

kubernetes google-kubernetes-engine google-artifact-registry autopilot

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