Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 7e5ee28

Browse files
committed
2 parents 6904e26 + 60476c8 commit 7e5ee28

File tree

4 files changed

+92
-30
lines changed

4 files changed

+92
-30
lines changed

.DS_Store

0 Bytes
Binary file not shown.

README.md

Lines changed: 92 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
[![Build Status](https://travis-ci.org/IBM/Microservices-deployment-with-PaaS-Containers-and-Serverless-Platforms.svg?branch=master)](https://travis-ci.org/IBM/Microservices-deployment-with-PaaS-Containers-and-Serverless-Platforms)
22

3-
# Navigate microservices deplyoment options with Cloud Foundry, Kubernetes, OpenWhisk and Istio
3+
# Navigate application deployment options with Cloud Foundry, Kubernetes, OpenWhisk and Istio
44

5-
Microservices and containers are now influencing application design and deployment patterns and will continue to do so for the foreseeable future. According to one survey, 60 percent of all new applications will use cloud-enabled continuous delivery microservice architectures, DevOps, and containers. But with the proliferation of microservices, a number of deployment platforms have emerged. What do we choose and why? In this journey, we help you navigate microservices deployment options with some popular microservices platforms like Cloud Foundry, Kubernetes, OpenWhisk and Istio
5+
PaaS platforms like Cloud Foundry, container orchestrators like Kubernetes, Serverless platforms like OpenWhisk and Service-mesh like Istio are all great technologies to deploy and manage your microservices on. Common wisdom says there is no such thing as too many choices, but abundance of choices can lead to analysis paralysis. In this code we look at deployment experience the different platforms provide, and what do we gain and loose by choosing one vs another.
66

7-
We use a sample Node.js application, flightassist for demonstrating and comparing various microservices deployment technologies. Specifically, a set of trade-offs and comparisons can be made between these deployment models, and this application is a proving ground for those discussions.
7+
We start with a sample Node.js monolithic application, Flightassist, factor it into two microservices, and then use it for demonstrating and comparing various deployment technologies. A set of trade-offs and comparisions can be made between these deployment models, and this application provides a basis for those discussions.
88

99
![architecure-diagram](images/paas-containers.png)
1010

11-
#### Scenario One: Deploy Flightassist microservices on Cloud Foundry
12-
#### Scenario Two: Deploy Flightassist microservices on Kubernetes Clusters
13-
#### Scenario Three: Deploy Flightassist microservices on Istio
14-
#### Scenario Four: Deploy Flightassist microservices augmented with functions on OpenWhisk
11+
#### [Scenario One: Deploy Flightassist monolithic application on Cloud Foundry](#2-deploy-monolithic-flightassist-application-using-cloud-foundry)
12+
#### [Scenario Two: Deploy Flightassist microservices on Cloud Foundry](#4-deploy-flightassist-microservices-on-cloud-foundry)
13+
#### [Scenario Three: Deploy Flightassist microservices on Kubernetes Clusters](#5-deploy-flightassist-microservices-on-kubernetes-cluster)
14+
#### [Scenario Four: Deploy Flightassist microservices on Istio](#6-deploy-flightassist-microservices-on-istio)
15+
#### [Scenario Five: Deploy Flightassist microservices augmented with functions on OpenWhisk](#7-deploy-flightassist-leveraging-openwhisk-functions)
1516

1617
## Included Components
1718
The scenarios are accomplished by using:
@@ -49,16 +50,18 @@ Then, click **View logs and history** under Kubernetes Deploy stage in your pipe
4950

5051
# Steps
5152

52-
1. [Provision application services - Cloudant Database and Insights for Weather Service](#1-create-your-cloudant-database-and-insights-for-weather-service)
53-
2. [Deploy monolithic application](#deploy-monolithic-flightassist-application-using-cloud-foundry)
54-
3. [Factor monolithic application into microservices and test](#factor-monolithic-application-into-microservices-and-test)
53+
## Part A: Deploy, test and factor monolithic application into microservices:
5554

56-
## Deploy microservices leveraging:
55+
1. [Provision application services - Cloudant Database and Insights for Weather Service](#1-create-your-cloudant-database-and-insights-for-weather-service)
56+
2. [Deploy monolithic application](#2-deploy-monolithic-flightassist-application-using-cloud-foundry)
57+
3. [Factor monolithic application into microservices and test](#3-factor-monolithic-application-into-microservices-and-test)
58+
59+
## Part B: Deploy microservices leveraging:
5760

58-
4. [Cloud Foundry](#scenario-one-deploy-flightassist-microservices-on-cloud-foundry-1)
59-
5. [Kubernetes Cluster](#scenario-two-deploy-flightassist-microservices-on-kubernetes-cluster)
60-
6. [Istio](#scenario-three-deploy-flightassist-microservices-on-istio)
61-
7. [OpenWhisk](scenario-four-deploy-flightassist-leveraging-openWhisk-functions)
61+
4. [Cloud Foundry](#4-deploy-flightassist-microservices-on-cloud-foundry)
62+
5. [Kubernetes Cluster](#5-deploy-flightassist-microservices-on-kubernetes-cluster)
63+
6. [Istio](#6-deploy-flightassist-microservices-on-istio)
64+
7. [OpenWhisk](#7-deploy-flightassist-leveraging-openwhisk-functions)
6265

6366
After you deployed Flightassist using any platform, you can go to [How to Use Flightassist](#how-to-use-flightassist) and start testing your application.
6467

@@ -86,7 +89,7 @@ curl -k -X PUT {your-cloudantURL}/trips
8689
curl -k -X PUT {your-cloudantURL}/weather
8790
curl -k -X PUT {your-cloudantURL}/connections
8891
```
89-
# Deploy monolithic Flightassist application using Cloud Foundry
92+
# 2. Deploy monolithic Flightassist application using Cloud Foundry
9093

9194
In this scenario, we will deploy Flightassist as a monolithic application and host it on Cloud Foundry.
9295

@@ -112,7 +115,9 @@ application.
112115

113116
Congratulation, now you can learn about [How to Use Flightassist](#how-to-use-flightassist) and start testing your application.
114117

115-
# Factor monolithic application into microservices and test
118+
# 3. Factor monolithic application into microservices and test
119+
120+
To factor the application into microservices, we add a python microservice to the picture. Instead of directly accessing the apis from Node app, the python program will serve as a proxy to query. This step tests the two microservices and associated dockerfiles which are created.
116121

117122
First, install [Docker CLI](https://www.docker.com/community-edition#/download).
118123

@@ -130,14 +135,56 @@ docker build -f main_application/Dockerfile.local -t flightassist main_applicati
130135
docker build -f flightassist-weather/Dockerfile.alpine -t weather-service flightassist-weather
131136
docker-compose up
132137
```
133-
134138
Now, your FlightAssist application should be running on http://localhost:3000/
135139

136-
# Scenario One: Deploy Flightassist microservices on Cloud Foundry
140+
# 4. Deploy Flightassist microservices on Cloud Foundry
141+
142+
Make sure you have both developer accounts mentioned in prerequisites. Also make sure you have cloudant and weatherinsights services created as listed in [step 1](#1-create-your-cloudant-database-and-insights-for-weather-service).
143+
144+
In this scenario, we take the Flightassist which is factored in microservices. Since Cloud Foundry apps (warden containers) are not allowed to talk privately, they need to communicate via public route.
145+
146+
We first push the python microservice.
147+
```
148+
cf push <name1> -f path-to/flightassist-weather/manifest.yml
149+
```
150+
**make sure you pick a unique name for the app.**
151+
This will bring up the first app we need.
152+
The output should look like:
153+
```
154+
requested state: started
155+
instances: 1/1
156+
usage: 256M x 1 instances
157+
urls: <name1>.mybluemix.net
158+
last uploaded: Thu Jun 8 21:36:15 UTC 2017
159+
stack: unknown
160+
buildpack: python_buildpack
161+
```
162+
And we need the **urls** for next step.
163+
Now we will push the second app, but **without starting** it.
164+
```
165+
cf push <name2> -f path-to/main_application/manifest.yml --no-start
166+
```
167+
**make sure you pick a unique name for the app, too.**
168+
169+
Now we inject the environment variables as in monolithic deployment:
170+
- `FLIGHTSTATS_APP_ID` : application ID assigned by FlightStats
171+
- `FLIGHTSTATS_APP_KEY` : application key assigned by FlightStats
172+
- `TRIPIT_API_KEY` : API key assigned by TripIt
173+
- `TRIPIT_API_SECRET` : API secret assigned by TripIt
174+
- `BASE_URL`: You URL for accessing your application. In the format **https://**{app_name}.mybluemix.net**/**
175+
176+
Plus, a couple more since we have two apps:
177+
- `USE_WEATHER_SERVICE`: true
178+
- `MICROSERVICE_URL`: <i>name1</i>.mybluemix.net
179+
180+
Now we start the 2nd app:
181+
`cf start <name2>`
137182

138-
# Scenario Two: Deploy Flightassist microservices on Kubernetes Cluster
183+
You can now test the apps by going to http://<i>name2</i>.mybluemix.net
139184

140-
In this scenario, we want to break down Flightassist to multiple containers. Therefore, we will run Flightassist as our main application with weather-service as our microservice to query the weather data. Then, we will host those containers using Docker Compose or Kubernetes.
185+
# 5. Deploy Flightassist microservices on Kubernetes Cluster
186+
187+
In this scenario, we use the Flightassist microservices in which are in two containers. We will run Flightassist as our main application with weather-service as our microservice to query the weather data. Then, we will host those containers using Kubernetes.
141188

142189
First, follow the [Kubernetes Cluster Tutorial](https://github.com/IBM/container-journey-template) to create your own cluster on Bluemix.
143190

@@ -180,10 +227,13 @@ kubectl create -f flightassist.yaml
180227
Congratulation, now your Flightassist application should be running on `http://<your_node_ip>:30080`. You can go to [How to Use Flightassist](#how-to-use-flightassist) and start testing your application.
181228

182229

183-
# Scenario Three: Deploy Flightassist microservices on Istio
230+
# 6. Deploy Flightassist microservices on Istio
231+
232+
Istio is an open platform that provides a uniform way to connect, manage, and secure microservices. Istio is the result of a joint collaboration between IBM, Google and Lyft as a means to support traffic flow management, access policy enforcement and the telemetry data aggregation between microservices, all without requiring changes to the code
233+
234+
## 6.1 Installing Istio in your Cluster
184235

185-
## 1. Installing Istio in your Cluster
186-
### 1.1 Download the Istio source
236+
### Download the Istio source
187237
1. Download the latest Istio release for your OS: [Istio releases](https://github.com/istio/istio/releases)
188238
2. Extract and go to the root directory.
189239
3. Copy the `istioctl` bin to your local bin
@@ -192,7 +242,7 @@ Congratulation, now your Flightassist application should be running on `http://<
192242
## example for macOS
193243
```
194244

195-
### 1.2 Grant Permissions
245+
### Grant Permissions
196246
1. Run the following command to check if your cluster has RBAC
197247
```bash
198248
$ kubectl api-versions | grep rbac
@@ -212,7 +262,7 @@ Congratulation, now your Flightassist application should be running on `http://<
212262

213263
* If **your cluster has no RBAC** enabled, proceed to installing the **Control Plane**.
214264

215-
### 1.3 Install the [Istio Control Plane](https://istio.io/docs/concepts/what-is-istio/overview.html#architecture) in your cluster
265+
### Install the [Istio Control Plane](https://istio.io/docs/concepts/what-is-istio/overview.html#architecture) in your cluster
216266
```bash
217267
kubectl apply -f install/kubernetes/istio.yaml
218268
cd ..
@@ -227,7 +277,7 @@ istio-manager-251184572-x9dd4 2/2 Running 0
227277
istio-mixer-2499357295-kn4vq 1/1 Running 0
228278
```
229279

230-
## 2. Inject Istio Envoys on Flightassist.
280+
## 6.2. Inject Istio Envoys on Flightassist.
231281

232282
**Important**: You must complete [scenario two for Kubernetes Clusters](#2-kubernetes-clusters) in order to proceed the following steps.
233283

@@ -255,9 +305,9 @@ kubectl create -f <(istioctl kube-inject -f flightassist.yaml --includeIPRanges=
255305

256306
Congratulation, now your Flightassist application should be running on `http://<isito-ingress IP:Port>`.
257307

258-
# Scenario Four: Deploy Flightassist leveraging OpenWhisk functions
308+
# 7. Deploy Flightassist leveraging OpenWhisk functions
259309

260-
In this scenario, we will deploy Flightassist with serverless to show how you could replace your microservices with OpenWhisk actions.
310+
In this scenario, we will deploy Flightassist with a function to show how you could replace your microservices with OpenWhisk actions.
261311

262312
**Important**: You must complete [scenario two for Kubernetes Clusters](#2-kubernetes-clusters) in order to proceed the following steps.
263313

@@ -271,7 +321,7 @@ Then, install [OpenWhisk CLI](https://console.ng.bluemix.net/openwhisk/learn/cli
271321

272322
Next, edit `flightassist_serverless.yaml` and replace the `<namespace>` with your own namespace, `<your-app-end-point-url>` with your node ip and nodeport, and `<your-openwhisk-auth>` with your OpenWhisk authentication. You can run `wsk property get --auth | awk '{print $3}'` to view your OpenWhisk authentication.
273323

274-
Now, let's deploy the new flightassist app with serverless.
324+
Now, let's deploy the new flightassist app with serverless capability
275325
276326
```bash
277327
kubectl create -f flightassist_serverless.yaml
@@ -291,6 +341,18 @@ Now you can see the most recent flight status and weather for all your flights w
291341
292342
![Flightassist status](images/status.png)
293343
344+
# Summary
345+
346+
It's hard to compare the different technologies toe to toe since they are targeted for different use cases. However,we can get a sense of their pros and cons from the above example.
347+
348+
**Cloud Foundry**: Developer Centric; Developers don't have to build or maintain containers; Support various programming languages and libraries; Large bases of services; Kind of hacky to deploy multi apps; Needs to know CF functions well to manage.
349+
350+
**Kubernetes**: Orchestration tool that manages complicated container delolyments well; Large services available ;Developer has to build and maintain containers in the repositories.
351+
352+
**Istio**: Addtion to Kubernetes; Provide load balancing and other features; Needs to know the "envoy" concept.
353+
354+
**OpenWhisk**: Serverless, event triggering; low cost; function based, doesn't work for large apps; Stateless.
355+
294356
## Code Structure
295357

296358
### Cloud Foundry application

images/paas-containers.png

93.4 KB
Loading

main_application/.DS_Store

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)