Independent deployment solution ( GKE, VBox, AWS, Play with k8s ) of two simple multi-tier applications using Kubernetes container orchestration technology
- GKE (Google Kubernetes Engine) (Preferred and Easy)
- AWS or any other cloud provider
- Virtual Box (Local Deployment)
- play-with-k8s (Remote temporary test deployment)
- Please ensure that three or more VM's with a minimum of 1024 MB of RAM are created. (One of these will be a master and the others will be slave nodes)
- Please ensure that intercommunication between all nodes is enabled. you can do this through Host-only adapter with minimal changes to hosts file.
- This demo is a kubernetes cluster deployment. So we will be using Kubeadm. Don't use MiniKube.
- GKE itself is a cluster manager and orchestration system for running your Docker containers. So there is no need for you to install Kubeadm or minikube. If you are using GKE or play-with-k8s, please skip this section.
- If you are using AWS or Virtual Box, then you need to install Kubectl and Kubeadm on master node. Please note down the join command you get after you run the init command.
- Start the Kubeadm on master node using
kubeadm init
. Specify optional parameters to the command if you want to use a different network interface. - Establish a pod network to enable intercommunication between pods. There are pre-built solutions that you can take advantage of like Flannel, Weave Net, Calico etc.
- Run the previously noted join command in each of the slave nodes to make them join the cluster.
- Run
kubectl get nodes
to test whether the nodes you joined are now part of the cluster. - Now you have successfully setup a kubernetes cluster and you are good to deploy applications.
- Clone this project to the master node of your kubernetes cluster.
- If you want to set up a guest book application. please go to the Guestbook folder. If you want to set up a voting app. please go to the Votingapp folder. Do not run both of them on the same cluster.
- Run the deployment yaml file first and it's respective service file next. In kubernetes, we use the same command to set up a pod, service, replicaset and deployment. The way that kubernetes know which is which is by specifying the kind in the yaml file.
- The command is
kubectl create -f <deployment-file.yaml>
followed bykubectl create -f <service-file.yaml>
. If you are using a LoadBalancer Port type and you have a load balancer configured (GKE has it pre-configured), the deployment will take some time. please wait until the deployment is running and then create its respective service. - You can use
kubectl get all
to see the status of the pods, deployments, replicasets etc. - After you have created all pods and services for a given application (Guestbook or Votingapp), you now will have a multi-tier application.