with the following deployment file:
apiVersion: v1
kind: Service
metadata:
name: tongpeer
spec:
selector:
name: busybox
clusterIP: None
ports:
- name: foo # Actually, no port is needed.
port: 1234
targetPort: 1234
---
apiVersion: v1
kind: Pod
metadata:
name: busybox1
labels:
name: busybox
spec:
hostname: busybox-1
subdomain: tongpeer
containers:
- image: busybox
command:
- sleep
- "3600"
name: busybox
---
apiVersion: v1
kind: Pod
metadata:
name: busybox2
labels:
name: busybox
spec:
hostname: busybox-2
subdomain: tongpeer
containers:
- image: busybox
command:
- sleep
- "3600"
name: busybox
When this gets deployed onto default namespace,
The service name becomes tongpeer.default.svc.fabricnet, which can be nslookup by
nslookup tongpeer
nslookup tongpeer.default.svc.fabricnet
Two busybox get names like the following:
busybox-1.tongpeer.default.svc.fabricnet
busybox-2.tongpeer.default.svc.fabricnet
nslookup will work with the full name for pods.
If the namespace is called tongnet, then the names will be
tongpeer
tongpeer.tongnet.svc.fabricnet
busybox-1.tongpeer.tongnet.svc.fabricnet
busybox-2.tongpeer.tongnet.svc.fabricnet
Need to figure out why there is svc.fabricnet at the end.
No comments:
Post a Comment