服务未准备好:gitlab-managed-apps/ingress-nginx-ingress-controller

Posted

技术标签:

【中文标题】服务未准备好:gitlab-managed-apps/ingress-nginx-ingress-controller【英文标题】:Service is not ready: gitlab-managed-apps/ingress-nginx-ingress-controller 【发布时间】:2020-12-22 09:47:36 【问题描述】:

我想在我的自托管系统上构建一个 gitlab + kubernetes 小型 gitops。但是当我尝试从 gitlab kubernetes 部分安装 nginx 入口时,我收到了这个错误:

Service is not ready: gitlab-managed-apps/ingress-nginx-ingress-controller

因为我使用的是自托管的 kubernetes,所以我需要修补 LoadBalancer nginx-ingress 服务。

kubectl patch svc ingress-nginx-ingress-controller -n gitlab-managed-apps -p '"spec": "type": "LoadBalancer", "externalIPs":["10.0.0.5","10.0.0.6","10.0.0.7"]'

但这并不能解决问题。

我检查这个命名空间中的事件:

18m         Normal    Started             pod/ingress-nginx-ingress-default-backend-78dd5dc449-fpvwb    Started container nginx-ingress-default-backend
18m         Normal    Created             pod/ingress-nginx-ingress-default-backend-78dd5dc449-fpvwb    Created container nginx-ingress-default-backend
18m         Normal    Started             pod/ingress-nginx-ingress-controller-7fdc67ff64-spxsn         Started container nginx-ingress-controller
18m         Normal    Created             pod/ingress-nginx-ingress-controller-7fdc67ff64-spxsn         Created container nginx-ingress-controller
18m         Normal    Pulled              pod/ingress-nginx-ingress-controller-7fdc67ff64-spxsn         Container image "quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.28.0" already present on machine
18m         Normal    Pulled              pod/ingress-nginx-ingress-default-backend-78dd5dc449-fpvwb    Container image "k8s.gcr.io/defaultbackend-amd64:1.5" already present on machine
18m         Normal    ExternalIP          service/ingress-nginx-ingress-controller                      Count: 0 -> 3
13m         Normal    Killing             pod/ingress-nginx-ingress-controller-7fdc67ff64-spxsn         Stopping container nginx-ingress-controller
13m         Normal    Killing             pod/ingress-nginx-ingress-default-backend-78dd5dc449-fpvwb    Stopping container nginx-ingress-default-backend
13m         Warning   Unhealthy           pod/ingress-nginx-ingress-default-backend-78dd5dc449-fpvwb    Readiness probe failed: Get "http://192.168.126.172:8080/healthz": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
12m         Warning   Unhealthy           pod/ingress-nginx-ingress-controller-7fdc67ff64-spxsn         Readiness probe failed: HTTP probe failed with statuscode: 500
12m         Warning   Unhealthy           pod/ingress-nginx-ingress-controller-7fdc67ff64-spxsn         Liveness probe failed: HTTP probe failed with statuscode: 500

安装入口 pod 时生成的 Readines 和 Liveness 行,终止所有相关的 pod、服务。

来自安装入口 pod 的日志:

...

[tiller] 2020/09/02 22:41:21 performing install for ingress
[tiller] 2020/09/02 22:41:21 executing 0 crd-install hooks for ingress
[tiller] 2020/09/02 22:41:21 hooks complete for crd-install ingress
[tiller] 2020/09/02 22:41:21 executing 0 pre-install hooks for ingress
[tiller] 2020/09/02 22:41:21 hooks complete for pre-install ingress
[storage] 2020/09/02 22:41:21 getting release history for "ingress"
[storage] 2020/09/02 22:41:21 creating release "ingress.v1"
[kube] 2020/09/02 22:41:21 building resources from manifest
[kube] 2020/09/02 22:41:21 creating 10 resource(s)
[kube] 2020/09/02 22:41:21 beginning wait for 10 resources with timeout of 5m0s
[kube] 2020/09/02 22:41:23 Service is not ready: gitlab-managed-apps/ingress-nginx-ingress-controller
[kube] 2020/09/02 22:41:25 Service is not ready: gitlab-managed-apps/ingress-nginx-ingress-controller
[kube] 2020/09/02 22:41:27 Service is not ready: gitlab-managed-apps/ingress-nginx-ingress-controller
[kube] 2020/09/02 22:41:29 Service is not ready: gitlab-managed-apps/ingress-nginx-ingress-controller

...

当我开始安装 ingress 并修补服务时,ingress 工作,我可以对 ingressm 等进行查询。

【问题讨论】:

似乎 K8s 无法到达 pod 进行 helthcheck。那么,你为什么要修补入口? ingress 仅适用于云提供商,或者您使用 MetalLB 之类的东西。 因为gitlab无法安装ingress其他模式。 【参考方案1】:

发布安装日志(安装期间):

kubectl logs pod/install-ingress-nginx -n gitlab-managed-apps

我遇到了同样的问题。对于裸机安装,请使用 MetalLB:https://metallb.universe.tf/installation/ 和 https://metallb.universe.tf/configuration/

您可以使用 helm:https://github.com/bitnami/charts/tree/master/bitnami/metallb,然后您必须更改命名空间和名称:

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: default
  name: metallb
data:
  config: |
      address-pools:
      - addresses:
        - 192.168.1.100-192.168.88.110
        name: default
        protocol: layer2

您需要为 service/ingress-nginx-ingress-controller 获取外部 IP:

kubectl get svc --all-namespaces

有关负载平衡支持的更多信息:https://rancher.com/docs/rancher/v2.x/en/k8s-in-rancher/load-balancers-and-ingress/load-balancers/

https://kubernetes.github.io/ingress-nginx/deploy/baremetal/

【讨论】:

以上是关于服务未准备好:gitlab-managed-apps/ingress-nginx-ingress-controller的主要内容,如果未能解决你的问题,请参考以下文章

PhoneGap/Cordova 设备未准备好

ICDevice 未准备好

Soundpool.builder 样本未准备好

本地文件的 AVPlayerStatus 未准备好

android Glide 资源已准备好但图像未显示

以下简单查询未完成。准备好的声明