Hands-On Kubernetes on Azure
上QQ阅读APP看书,第一时间看更新

The guestbook application in action

Type the public IP on your favorite browser. You should get the following screenshot:

Go ahead, record your messages. It will be saved. Go crazy, open another browser and type the same IP; you will see all the messages you typed.

Congratulations, you have completed your first fully-deployed, multi-tier, cloud-native Kubernetes application!

The frontend did not show up on our first try. It turned out for the small machines we were using. Kubernetes was not able to schedule three replicas of the frontend. We had to download the  frontend-deployment.yaml file and change the replicas to 1 and also reduce the CPU task. The problem was discovered by typing
kubectl get events

Alas, the preceding method of deploying has become obsolete already. We needed to give it a try for these reasons: 

  • For prototyping, you probably will start from one of those yaml files.
  • The basic concepts of Deployment, Replica Sets, Services, and Pods do not change and need to be understood in detail.
  • The obsolete part is not true at all.

Still, to conserve resources on our free trial virtual machines, it is better to delete the deployments we made to run the next round of the deployment by using the following commands:

kubectl delete deployment -l app=redis
kubectl delete service -l app=redis
kubectl delete deployment -l app=guestbook
kubectl delete service -l app=guestbook