7.1.3 Service discovery
View in the book.
Buy the book.
Get the name of the internal service created in 7.1.2
$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 34.118.224.1 <none> 443/TCP 98m
robohash-internal ClusterIP 34.118.234.111 <none> 80/TCP 6m28s
timeserver LoadBalancer 34.118.238.176 35.233.155.58 80:32534/TCP 94m
We can reference this in the Deployment
And add a new endpoint /avatar
to generate a Random robot
Replace the Deployment:
$ cd Chapter07/7.1_InternalServices
$ kubectl replace -f timeserver-deploy-dns.yaml
Create the service if needed
$ kubectl create -f timeserver-service.yaml
service/timeserver created
Wait for the new Pods to become ready
watch kubectl get deploy
Get the IP of our main service:
$ kubectl get svc/timeserver -w
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
timeserver LoadBalancer 34.118.238.176 203.0.113.16 80:32534/TCP 95m
Append /avatar
to the IP and browse to it. Refresh the page to generate
different robots.