我已根据https://github.com/CiscoCloud/kubernetes-ansible在debian上部署了我的群集。 一切正常,除了一些插件,我怀疑名称解析。
我是这样定义的rc
apiVersion: v1
kind: ReplicationController
metadata:
name: monitoring-influx-grafana-v1
namespace: kube-system
labels:
k8s-app: influxGrafana
version: v1
kubernetes.io/cluster-service: "true"
spec:
replicas: 1
selector:
k8s-app: influxGrafana
version: v1
template:
metadata:
labels:
k8s-app: influxGrafana
version: v1
kubernetes.io/cluster-service: "true"
spec:
containers:
- image: gcr.io/google_containers/heapster_influxdb:v0.3
name: influxdb
resources:
limits:
cpu: 100m
memory: 200Mi
ports:
- containerPort: 8083
hostPort: 8083
- containerPort: 8086
hostPort: 8086
volumeMounts:
- name: influxdb-persistent-storage
mountPath: /data
- image: gcr.io/google_containers/heapster_grafana:v0.7
name: grafana
resources:
limits:
cpu: 100m
memory: 100Mi
env:
- name: INFLUXDB_EXTERNAL_URL
value: /api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb:api/db/
- name: INFLUXDB_HOST
value: monitoring-influxdb
- name: INFLUXDB_PORT
value: "8086"
volumes:
- name: influxdb-persistent-storage
emptyDir: {}
因此容器连接到名为" monitoring-influxdb"的主机。 实际上,当我使用" busy-box"时,dns可以很好地解析这个名称。荚:
kubectl exec busybox --namespace=kube-system -- nslookup monitoring-influxdb
Server: 10.233.0.10
Address 1: 10.233.0.10
名称:monitoring-influxdb 地址1:10.233.83.114
但是在monitoring-influx-grafana-v1 pod中,名称未解析:
kubectl exec monitoring-influx-grafana-v1-obu8h --namespace=kube-system -- ping -c 1 monitoring-influxdb
PING monitoring-influxdb.kube-system.svc.osm.local (10.233.83.114) 56(84) bytes of data.
--- monitoring-influxdb.kube-system.svc.osm.local ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
注意" kubernetes"服务已解决
kubectl exec monitoring-influx-grafana-v1-obu8h --namespace=kube-system -- ping -c 1 kubernetes
PING kubernetes.default.svc.osm.local (10.233.0.1) 56(84) bytes of data.
64 bytes from 10.233.0.1: icmp_seq=1 ttl=63 time=0.441 ms
--- kubernetes.default.svc.osm.local ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
```
服务在etcd
中定义如下{'apiVersion': 'v1',
'kind': 'Endpoints',
'metadata': {'creationTimestamp': '2015-08-31T16:11:47Z',
'labels': {'kubernetes.io/cluster-service': 'true',
'kubernetes.io/name': 'InfluxDB'},
'name': 'monitoring-influxdb',
'namespace': 'kube-system',
'resourceVersion': '219',
'selfLink': '/api/v1/namespaces/kube-system/endpoints/monitoring-influxdb',
'uid': 'fab1bd0d-4ffa-11e5-bad3-52540011ed64'},
'subsets': [{'addresses': [{'ip': '10.233.3.5',
'targetRef': {'kind': 'Pod',
'name': 'monitoring-influx-grafana-v1-obu8h',
'namespace': 'kube-system',
'resourceVersion': '391',
'uid': 'fa6fb734-4ffa-11e5-bad3-52540011ed64'}}],
'ports': [{'name': 'http', 'port': 8083, 'protocol': 'TCP'},
{'name': 'api', 'port': 8086, 'protocol': 'TCP'}]}]}
我认为这个问题也会导致其他pod的错误
kubectl logs kibana-logging-v1-ifztn --namespace=kube-system
...
{"@timestamp":"2015-08-31T16:13:29.082Z","level":"info","message":"Unable to connect to elasticsearch at http://elasticsearch-logging:9200. Retrying in 2.5 seconds.","node_env":"production"}
...
kubectl logs monitoring-heapster-v8-9cy06 --namespace=kube-system
...
E0831 16:12:27.367871 1 driver.go:326] Database creation failed: Post http://monitoring-influxdb:8086/db?u=root&p=root: dial tcp: lookup monitoring-influxdb: no such host. Retrying after 30 seconds
...
此致 Smana
答案 0 :(得分:2)
Smana, 1)就像你再次猜到的那样,它不是DNS解析问题 PING monitoring-influxdb.kube-system.svc.osm.local(10.233.83.114)56(84)字节的数据。 ping命令表示正在ping IP 10.233.83.144
2)群集ips不支持ICMP。目前,仅支持tcp和udp。因此ping失败。