AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1053046
Accepted
csgeek
csgeek
Asked: 2021-02-10 16:48:48 +0800 CST2021-02-10 16:48:48 +0800 CST 2021-02-10 16:48:48 +0800 CST

入口 Nginx SSL 503 错误

  • 772

服务.yaml

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: grafana
  name: grafana
spec:
  ports:
    - name: "3000"
      port: 3000
      targetPort: 3000
  selector:
    io.kompose.service: grafana
status:
  loadBalancer: {}

部署:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.22.0 (HEAD)
  creationTimestamp: null
  labels:
    io.kompose.service: grafana
  name: grafana
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: grafana
  strategy: {}
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert
        kompose.version: 1.22.0 (HEAD)
      creationTimestamp: null
      labels:
        io.kompose.service: grafana
    spec:
      containers:
        - env:
            - name: GF_SERVER_DOMAIN
              #              value: "testing.esamir.com"
              value: "direct.esamir.com"
            - name: GF_SERVER_ROOT_URL
              value: "%(protocol)s://%(domain)s:%(http_port)s/"
            - name: GF_SERVER_SERVE_FROM_SUB_PATH
              value: "true"
            - name: GF_DATABASE_URL
              valueFrom:
                configMapKeyRef:
                  name: grafanaconfig
                  key: url

          image: grafana/grafana:7.4.0-ubuntu
          name: grafana
          ports:
            - containerPort: 3000
          resources: {}
      restartPolicy: Always
status: {}

入口-nginx 配置:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: hello-kubernetes-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
    - host: testing1.com
      http:
        paths:
          - backend:
              serviceName: hello-kubernetes-second
              servicePort: 80
    - host: testing2.com
      http:
        paths:
          - backend:
              serviceName: dashboard
              servicePort: 3000

如果我在 testing1.com 上连接到 http 或 https,它正在运行一个简单的 hello-world kubernetes 应用程序。一切都完美无缺。

如果我在 https 或 http 上连接到 testin2.com,我会收到 503 错误。“503服务暂时不可用”

查看日志,我发现了这个错误:“2021-02-09 15:34:25.309 PSTError getting Endpoints for Service "test/dashboard": no object matching key "test/dashboard" in local store"

作为参考,我的所有清单都部署在 K8 的 test 命名空间下。

我在网上找到的大多数参考资料都在谈论确保服务具有有效的端点。

kubectl 获取端点 --namespace 测试

NAME                                       ENDPOINTS                                      AGE
grafana                                    10.68.5.23:3000                                6h4m
hello-kubernetes-second                    10.68.3.9:8080,10.68.5.5:8080,10.68.6.6:8080   6h22m
nginx-ingress-nginx-controller             10.68.5.8:443,10.68.5.8:80                     6h20m
nginx-ingress-nginx-controller-admission   10.68.5.8:8443                                 6h20m

kubectl 描述 svc grafana -n 测试


Namespace:         test
Labels:            io.kompose.service=grafana
Annotations:       <none>
Selector:          io.kompose.service=grafana
Type:              ClusterIP
IP:                10.71.248.111
Port:              3000  3000/TCP
TargetPort:        3000/TCP
Endpoints:         10.68.5.23:3000
Session Affinity:  None
Events:            <none>

据我所知,我的服务确实有一个有效的端点。我错过了什么?

google-cloud-platform kubernetes grafana ingress
  • 1 1 个回答
  • 1019 Views

1 个回答

  • Voted
  1. Best Answer
    PjoterS
    2021-02-12T02:02:28+08:002021-02-12T02:02:28+08:00

    正如评论部分提到的,问题的根本原因是入口配置错误。

    其中一条Ingress路径是指向不存在的服务 - dashboard. 一旦更改为grafana,入口应该可以正常工作。

    • 1

相关问题

  • 带有 OpenVPN 的 Google Compute Engine 上的 VPN 服务器

  • 如果您失去了 Google Apps 的管理员权限,如何恢复?

  • 云有多大?[关闭]

  • 谷歌应用引擎中的 joomla

  • 无需短信即可注册 Google AppEngine?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve