Lab 1 - Deploy Application
Last updated
Last updated
Let's investigate how Helm can help us focus on other things by letting a chart do the work for us. We'll first deploy an application to a Kubernetes cluster by using kubectl
and then show how we can offload the work to a chart by deploying the same app with Helm.
The application is the Guestbook App, which is a sample multi-tier web application.
kubectl
In this part of the lab, we will deploy the application using the Kubernetes client kubectl
. We will use Version 1 of the app for deploying here.
If you already have a copy of the guestbook application installed from the kube101 lab, skip this section and go the helm
example in Scenario 2.
Clone the Guestbook App repo to get the files:
Use the configuration files in the cloned Git repository to deploy the containers and create services for them by using the following commands:
Refer to the guestbook README for more details.
View the guestbook:
You can now play with the guestbook that you just created by opening it in a browser (it might take a few moments for the guestbook to come up).
Local Host: If you are running Kubernetes locally, view the guestbook by navigating to http://localhost:3000
in your browser.
Remote Host:
To view the guestbook on a remote host, locate the external IP and port of the load balancer in the EXTERNAL-IP and PORTS columns of the $ kubectl get services
output.
In this scenario the URL is http://50.23.5.136:31838
.
Note: If no external IP is assigned, then you can get the external IP with the following command:
In this scenario the URL is http://173.193.92.112:31838
.
Navigate to the output given (for example http://50.23.5.136:31838
) in your browser. You should see the guestbook now displaying in your browser:
In this part of the lab, we will deploy the application by using Helm. We will set a release name of guestbook-demo
to distinguish it from the previous deployment. The Helm chart is available here. Clone the Helm 101 repo to get the files:
A chart is defined as a collection of files that describe a related set of Kubernetes resources. We probably then should take a look at the the files before we go and install the chart. The files for the guestbook
chart are as follows:
Note: The template files shown above will be rendered into Kubernetes manifest files before being passed to the Kubernetes API server. Therefore, they map to the manifest files that we deployed when we used kubectl
(minus the helper and notes files).
Let's go ahead and install the chart now. If the helm-demo
namespace does not exist, you will need to create it using:
Install the app as a Helm chart:
You should see output similar to the following:
The chart install performs the Kubernetes deployments and service creations of the redis master and slaves, and the guestbook app, as one. This is because the chart is a collection of files that describe a related set of Kubernetes resources and Helm manages the creation of these resources via the Kubernetes API.
Check the deployment:
You should see output similar to the following:
To check the status of the running application pods, use:
You should see output similar to the following:
To check the services, use:
View the guestbook:
You can now play with the guestbook that you just created by opening it in a browser (it might take a few moments for the guestbook to come up).
Local Host: If you are running Kubernetes locally, view the guestbook by navigating to http://localhost:3000
in your browser.
Remote Host:
To view the guestbook on a remote host, locate the external IP and the port of the load balancer by following the "NOTES" section in the install output. The commands will be similar to the following:
Combine the service IP with the port of the service printed earlier. In this scenario the URL is http://50.23.5.136:31367
.
Note: If no external IP is assigned, then you can get the external IP with the following command:
In this scenario the URL is http://173.193.92.112:31367
.
Navigate to the output given (for example http://50.23.5.136:31367
) in your browser. You should see the guestbook now displaying in your browser:
Congratulations, you have now deployed an application by using two different methods to Kubernetes! From this lab, you can see that using Helm required less commands and less to think about (by giving it the chart path and not the individual files) versus using kubectl
. Helm's application management provides the user with this simplicity.
Move on to the next lab, Lab2, to learn how to update our running app when the chart has been changed.