Deploy to the Internet
Distributed Services with Go — by Travis Jeffery (82 / 84)
👈 Create Custom Controllers with Metacontroller | TOC | What You Learned 👉
This is the moment we’ve been building up to over the course of the book: deploying our distributed service to the cloud. Run the following command:
$ helm install proglog proglog \
--set image.repository=gcr.io/$PROJECT_ID/proglog \
--set service.lb=true
This command installs our proglog chart to our GKE cluster. We’ve set the image repository to configure the StatefulSet to pull the image from the Google Container Registry. And we’ve enabled the service-per-pod controller. You can watch as the services come up by passing the -w flag:
$ kubectl get services -w
When all three load balancers are up, we can verify that our client connects to our service running in the cloud and that our service nodes discovered each other:
$ ADDR=$(kubectl get service \
-l app=service-per-pod \
-o go-template=\
'{{range .items}}\
{{(index .status.loadBalancer.ingress 0).ip}}{{"\n"}}\
{{end}}'\
| head -n 1)
$ go run cmd/getservers/main.go -addr=$ADDR:8400
servers:
- id:"proglog-0" rpc_addr:"proglog-0.proglog.default.svc.cluster.local:8400"
- id:"proglog-1" rpc_addr:"proglog-1.proglog.default.svc.cluster.local:8400"
- id:"proglog-2" rpc_addr:"proglog-2.proglog.default.svc.cluster.local:8400"