信息:
说明
我有这个状态集:
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: busy
spec:
serviceName: busy
selector:
matchLabels:
app: busy
replicas: 3
template:
metadata:
name: busy
labels:
app: busy
spec:
containers:
- name: busy
image: busybox:1.28
imagePullPolicy: IfNotPresent
command:
- sleep
- "3600"
restartPolicy: Always
这项无头的服务:
---
kind: Service
apiVersion: v1
metadata:
name: busy-headless
spec:
clusterIP: None
publishNotReadyAddresses: true
selector:
app: busy
有状态集创建3个Pod(忙-{1,2,3})。根据{{3}},每个吊舱都应有一个busy-{1,2,3}.busy-headless.default.svc.cluster.local
之类的DNS记录。
问题
当我尝试从busy-headless.default.svc.cluster.local
解析与记录busy-0
关联的DNS条目时,我得到
17:00 $ kubectl exec -ti busy-0 -- nslookup busy-headless.default.svc.cluster.local
Server: 10.233.0.3
Address 1: 10.233.0.3 coredns.kube-system.svc.cluster.local
Name: busy-headless.default.svc.cluster.local
Address 1: 10.233.67.10 10-233-67-10.busy-headless.default.svc.cluster.local
Address 2: 10.233.68.27 10-233-68-27.busy-headless.default.svc.cluster.local
Address 3: 10.233.68.26 10-233-68-26.busy-headless.default.svc.cluster.local
Address 4: 10.233.69.11 busy-0.busy.default.svc.cluster.local
该命令从busy-1
返回busy-1.busy.default.svc.cluster.local
的{{1}}和busy-1
返回10-233-69-11.busy-headless.default.svc.cluster.local
。
busy-0
上的nslookup返回错误。
可能是什么问题?
谢谢!
答案 0 :(得分:1)
在您的StatefulSet清单中尝试指定:
serviceName: busy-headless