Kubernetes终结点抛出“ServiceUnavailable”`

Kubernetes终结点抛出“ServiceUnavailable”`,kubernetes,influxdb,Kubernetes,Influxdb,我在AWS上有一个新的Kubernetes集群,它是使用v1.1.1中的kube-up脚本构建的。我可以成功访问Elasticsearch/Kibana/KubeUI/Grafana端点,但无法通过API代理从我的机器访问Heapster/KubeDNS/InfluxDB。我在K8S项目中看到了一些与此相关的辅助问题,但没有明确说明发生了什么。据我所知,一切都很顺利,所以我不确定这里出了什么问题?我真的很想使用Grafana/Influx/Heapster的嵌入式监控,但是Grafana仪表板只

我在AWS上有一个新的Kubernetes集群,它是使用v1.1.1中的
kube-up
脚本构建的。我可以成功访问Elasticsearch/Kibana/KubeUI/Grafana端点,但无法通过API代理从我的机器访问Heapster/KubeDNS/InfluxDB。我在K8S项目中看到了一些与此相关的辅助问题,但没有明确说明发生了什么。据我所知,一切都很顺利,所以我不确定这里出了什么问题?我真的很想使用Grafana/Influx/Heapster的嵌入式监控,但是Grafana仪表板只是空白,有一个系列错误

Kubernetes版本

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"1", GitVersion:"v1.1.1", GitCommit:"92635e23dfafb2ddc828c8ac6c03c7a7205a84d8", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"1", GitVersion:"v1.1.1", GitCommit:"92635e23dfafb2ddc828c8ac6c03c7a7205a84d8", GitTreeState:"clean"}
群集信息

$ kubectl cluster-info
Kubernetes master is running at https://MASTER_IP
Elasticsearch is running at https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/elasticsearch-logging
Heapster is running at https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/heapster
Kibana is running at https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/kibana-logging
KubeDNS is running at https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/kube-dns
KubeUI is running at https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/kube-ui
Grafana is running at https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana
InfluxDB is running at https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb
从上面的API代理URL访问XDB

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "no endpoints available for service \"monitoring-influxdb\"",
  "reason": "ServiceUnavailable",
  "code": 503
}
$ curl http://localhost:8080/api/v1/namespaces/kube-system/services/monitoring-influxdb
{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "monitoring-influxdb",
    "namespace": "kube-system",
    "selfLink": "/api/v1/namespaces/kube-system/services/monitoring-influxdb",
    "uid": "2f715831-8a22-11e5-b248-028ff74b9b1b",
    "resourceVersion": "60",
    "creationTimestamp": "2015-11-13T16:18:33Z",
    "labels": {
      "kubernetes.io/cluster-service": "true",
      "kubernetes.io/name": "InfluxDB"
    }
  },
  "spec": {
    "ports": [
      {
        "name": "http",
        "protocol": "TCP",
        "port": 8083,
        "targetPort": 8083
      },
      {
        "name": "api",
        "protocol": "TCP",
        "port": 8086,
        "targetPort": 8086
      }
    ],
    "selector": {
      "k8s-app": "influxGrafana"
    },
    "clusterIP": "10.0.35.241",
    "type": "ClusterIP",
    "sessionAffinity": "None"
  },
  "status": {
    "loadBalancer": {}
  }
}
来自主机的端点详细信息

$ curl http://localhost:8080/api/v1/namespaces/kube-system/endpoints/monitoring-influxdb
{
  "kind": "Endpoints",
  "apiVersion": "v1",
  "metadata": {
    "name": "monitoring-influxdb",
    "namespace": "kube-system",
    "selfLink": "/api/v1/namespaces/kube-system/endpoints/monitoring-influxdb",
    "uid": "2f75b259-8a22-11e5-b248-028ff74b9b1b",
    "resourceVersion": "131",
    "creationTimestamp": "2015-11-13T16:18:33Z",
    "labels": {
      "kubernetes.io/cluster-service": "true",
      "kubernetes.io/name": "InfluxDB"
    }
  },
  "subsets": [
    {
      "addresses": [
        {
          "ip": "10.244.1.4",
          "targetRef": {
            "kind": "Pod",
            "namespace": "kube-system",
            "name": "monitoring-influxdb-grafana-v2-n6jx1",
            "uid": "2f31ed90-8a22-11e5-b248-028ff74b9b1b",
            "resourceVersion": "127"
          }
        }
      ],
      "ports": [
        {
          "name": "http",
          "port": 8083,
          "protocol": "TCP"
        },
        {
          "name": "api",
          "port": 8086,
          "protocol": "TCP"
        }
      ]
    }
  ]
}
从主机查询服务

$ curl -IL 10.244.1.4:8083
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 13751
Content-Type: text/html; charset=utf-8
Last-Modified: Fri, 14 Nov 2014 21:55:58 GMT
Date: Tue, 17 Nov 2015 21:31:48 GMT
监控XDB服务

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "no endpoints available for service \"monitoring-influxdb\"",
  "reason": "ServiceUnavailable",
  "code": 503
}
$ curl http://localhost:8080/api/v1/namespaces/kube-system/services/monitoring-influxdb
{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "monitoring-influxdb",
    "namespace": "kube-system",
    "selfLink": "/api/v1/namespaces/kube-system/services/monitoring-influxdb",
    "uid": "2f715831-8a22-11e5-b248-028ff74b9b1b",
    "resourceVersion": "60",
    "creationTimestamp": "2015-11-13T16:18:33Z",
    "labels": {
      "kubernetes.io/cluster-service": "true",
      "kubernetes.io/name": "InfluxDB"
    }
  },
  "spec": {
    "ports": [
      {
        "name": "http",
        "protocol": "TCP",
        "port": 8083,
        "targetPort": 8083
      },
      {
        "name": "api",
        "protocol": "TCP",
        "port": 8086,
        "targetPort": 8086
      }
    ],
    "selector": {
      "k8s-app": "influxGrafana"
    },
    "clusterIP": "10.0.35.241",
    "type": "ClusterIP",
    "sessionAffinity": "None"
  },
  "status": {
    "loadBalancer": {}
  }
}
吊舱详细信息

$ kubectl describe pod --namespace=kube-system monitoring-influxdb-grafana-v2-n6jx
Name:               monitoring-influxdb-grafana-v2-n6jx1
Namespace:          kube-system
Image(s):           gcr.io/google_containers/heapster_influxdb:v0.4,beta.gcr.io/google_containers/heapster_grafana:v2.1.1
Node:               ip-172-20-0-44.us-west-2.compute.internal/172.20.0.44
Start Time:         Fri, 13 Nov 2015 08:21:36 -0800
Labels:             k8s-app=influxGrafana,kubernetes.io/cluster-service=true,version=v2
Status:             Running
Reason:
Message:
IP:             10.244.1.4
Replication Controllers:    monitoring-influxdb-grafana-v2 (1/1 replicas created)
Containers:
  influxdb:
    Container ID:   docker://564724318ca81d33d6079978d24f78b3c6ff8eb08a9023c845e250eeb888aafd
    Image:      gcr.io/google_containers/heapster_influxdb:v0.4
    Image ID:       docker://8b8118c488e431cc43e7ff9060968d88402cc6c38a6390c4221352403aa7ac1b
    QoS Tier:
      memory:   Guaranteed
      cpu:  Guaranteed
    Limits:
      memory:   200Mi
      cpu:  100m
    Requests:
      memory:       200Mi
      cpu:      100m
    State:      Running
      Started:      Fri, 13 Nov 2015 08:22:55 -0800
    Ready:      True
    Restart Count:  0
    Environment Variables:
  grafana:
    Container ID:   docker://518dea564a0ee014345e9006da6113fb6584ff1ebc6d0cc9609a608abc995f45
    Image:      beta.gcr.io/google_containers/heapster_grafana:v2.1.1
    Image ID:       docker://200e77ba156a5a86879e49667b97afe84dca42b5bb67ab1e06217e6a19c5a6a6
    QoS Tier:
      cpu:  Guaranteed
      memory:   Guaranteed
    Limits:
      memory:   100Mi
      cpu:  100m
    Requests:
      cpu:      100m
      memory:       100Mi
    State:      Running
      Started:      Fri, 13 Nov 2015 08:22:35 -0800
    Ready:      True
    Restart Count:  0
    Environment Variables:
      INFLUXDB_SERVICE_URL:     http://monitoring-influxdb:8086
      GF_AUTH_BASIC_ENABLED:        false
      GF_AUTH_ANONYMOUS_ENABLED:    true
      GF_AUTH_ANONYMOUS_ORG_ROLE:   Admin
      GF_SERVER_ROOT_URL:       /api/v1/proxy/namespaces/kube-system/services/monitoring-grafana/
Conditions:
  Type      Status
  Ready     True
Volumes:
  influxdb-persistent-storage:
    Type:   EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
  grafana-persistent-storage:
    Type:   EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
  default-token-bo89c:
    Type:   Secret (a secret that should populate this volume)
    SecretName: default-token-bo89c
No events.

不幸的是,这些URL是不完整的。Influx的端口是命名的,所以您需要说您想要哪个端口

https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb:http
https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb:api


存在一个漏洞,可以提供更好的错误信息。

您是否可以运行
kubectl decribe pod--namespace=kube system monitoring-influxdb-grafana-v2-n6jx
查看pod的状态(是否准备就绪)?您说“grafana仪表盘因一系列错误而空白”。错误是什么?它是什么样子的?我认为默认情况下,仪表板不显示任何内容,您必须自己手动添加图形。这将在下一个kubernetes版本中发生变化。如果我加载Grafana并导航到kubernetes集群仪表板,会有很多图,但它们都是空的。它们都有错误,如
InfluxDB Error:找不到序列:
。我还试图访问InfluxDB UI,也就是上面的503,我感兴趣的是。8083是InfluxDB的管理UI的端口。8086是API端口。假设这是InfluxDB 0.9,InfluxDB更好的健康检查是
curl-ihttp://10.244.1.4:8086/ping
,它应该在标题中返回版本号。@Becketsean如果我运行您的命令,我会得到
X-Influxdb-version:Influxdb v0.8.9(git:664b73e)(leveldb:1.15)
。这告诉我们什么?谢谢蒂姆·霍金。我看到了您对K8S项目和相关bug的一些评论。没有办法访问XDB UI吗?如果我尝试你的建议,我仍然会收到503个错误。我只是在我自己的集群上访问上面列出的:http URL,它就工作了。我不能确定你为什么会出现503错误-你能粘贴更多信息和你使用的准确URL(IP已编辑)吗?嗨@tim hockin,URL是您建议的:
https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb:8083
https://MASTER_IP/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb:8086
。URI都返回“没有可用的端点”,我说“:http”和“:api”-你输入数字-但无论如何,它应该可以工作。至少:8083适合我。确保URL中没有wierd剪切粘贴工件。我只是粘贴了上面的内容,但它没有起作用,因为换行符被编码到URL中作为非打印字符。哈哈,我的坏@tim hockin。我没有意识到这是对URL的文字添加。添加
:http
对我有用,但
:api
不行。谢谢你的帮助。