Deploy example application
A simple, multi-tier web application using Kubernetes and Docker.
This example consists of the following components:
- A single-instance redis master to store guestbook entries
- Multiple replicated redis slave instances to serve reads
- Multiple web frontend instances
(from Example: Deploying PHP Guestbook application with Redis document)
redis master
deployment
$ kubectl apply -f application/guestbook/redis-master-deployment.yaml deployment.apps/redis-master created
$ kubectl get pods NAME READY STATUS RESTARTS AGE redis-master-55db5f7567-nj6mt 1/1 Running 0 26s
service
$ kubectl apply -f application/guestbook/redis-master-service.yaml service/redis-master created
$ kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 100.64.0.1 <none> 443/TCP 24m redis-master ClusterIP 100.70.68.174 <none> 6379/TCP 2m
redis slave
deployment
$ kubectl apply -f application/guestbook/redis-slave-deployment.yaml deployment.apps/redis-slave created
$ kubectl get pods NAME READY STATUS RESTARTS AGE redis-master-55db5f7567-nj6mt 1/1 Running 0 6m redis-slave-584c66c5b5-prqhx 1/1 Running 0 21s redis-slave-584c66c5b5-zr4gg 1/1 Running 0 21s
service
$ kubectl apply -f application/guestbook/redis-slave-service.yaml service/redis-slave created
$ kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 100.64.0.1 <none> 443/TCP 27m redis-master ClusterIP 100.70.68.174 <none> 6379/TCP 5m redis-slave ClusterIP 100.70.55.105 <none> 6379/TCP 23s
frontend
deployment
$ kubectl apply -f application/guestbook/frontend-deployment.yaml deployment.apps/frontend created
$ kubectl get pods NAME READY STATUS RESTARTS AGE frontend-5c548f4769-dp7dx 1/1 Running 0 37s frontend-5c548f4769-fw8kd 1/1 Running 0 37s frontend-5c548f4769-hzk22 1/1 Running 0 37s redis-master-55db5f7567-nj6mt 1/1 Running 0 9m redis-slave-584c66c5b5-prqhx 1/1 Running 0 3m redis-slave-584c66c5b5-zr4gg 1/1 Running 0 3m
$ kubectl get pods -l app=guestbook -l tier=frontend NAME READY STATUS RESTARTS AGE frontend-5c548f4769-dp7dx 1/1 Running 0 57s frontend-5c548f4769-fw8kd 1/1 Running 0 57s frontend-5c548f4769-hzk22 1/1 Running 0 57s
service
$ kubectl apply -f application/guestbook/frontend-service.yaml service/frontend created
ask for the EXTERNAL-IP of the service
$ kubectl get service frontend NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE frontend LoadBalancer 100.65.126.11 aaf9577-1960.us-east-1.elb.amazonaws.com 80:30826/TCP 8s
access
Then access to http://aaf9577-1960.us-east-1.elb.amazonaws.com