Skip to content

Commit 44049c6

Browse files
authored
Enable Kubernetes Deployment (#32)
Kubernetes Deployment via CLI Continuation of @nheidloff work - Added a web app yaml file to match the one in the model repo - Added a Deploy on Kubernetes section to the README
1 parent e54d9e6 commit 44049c6

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ The following is a talk at Spark+AI Summit 2018 about MAX that includes a short
6161

6262
# Steps
6363

64-
Deploy to IBM Cloud **OR** run locally.
64+
Ways to run the code pattern:
65+
66+
- [Deploy to IBM Cloud](#deploy-to-ibm-cloud)
67+
- [Deploy on Kubernetes](#deploy-on-kubernetes)
68+
- [Run Locally](#run-locally)
6569

6670
## Deploy to IBM Cloud
6771

@@ -89,6 +93,18 @@ viewed by clicking `View app`.
8993

9094
![Delivery Pipeline](doc/source/images/ibm-cloud-deploy.png)
9195

96+
## Deploy on Kubernetes
97+
98+
You can also deploy the model and web app on Kubernetes using the latest docker images on Docker Hub.
99+
100+
On your Kubernetes cluster, run the following commands:
101+
102+
kubectl apply -f https://raw.githubusercontent.com/IBM/MAX-Image-Caption-Generator/master/image-caption-generator.yaml
103+
kubectl apply -f https://raw.githubusercontent.com/IBM/MAX-Image-Caption-Generator-Web-App/master/image-caption-generator-web-app.yaml
104+
105+
The web app will be available at port `8088` of your cluster.
106+
The model will only be available internally, but can be accessed externally through the `NodePort`.
107+
92108
## Run Locally
93109

94110
> NOTE: These steps are only needed when running locally instead of using the `Deploy to IBM Cloud` button.
@@ -210,7 +226,7 @@ you can change them with command-line options:
210226

211227
#### 5. Instructions for Docker (Optional)
212228

213-
To run the web app with Docker the containers running the webserver and the REST endpoint need to share the same
229+
To run the web app with Docker the containers running the web server and the REST endpoint need to share the same
214230
network stack. This is done in the following steps:
215231

216232
Modify the command that runs the Image Caption Generator REST endpoint to map an additional port in the container to a
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: image-caption-generator-web-app
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: image-caption-generator-web-app
9+
replicas: 1
10+
template:
11+
metadata:
12+
labels:
13+
app: image-caption-generator-web-app
14+
spec:
15+
containers:
16+
- name: image-caption-generator-web-app
17+
image: codait/max-image-caption-generator-web-app:latest
18+
command: ["python", "app.py", "--ml-endpoint=http://image-caption-generator:5000"]
19+
ports:
20+
- containerPort: 8088
21+
---
22+
apiVersion: v1
23+
kind: Service
24+
metadata:
25+
labels:
26+
name: image-caption-generator-web-app
27+
name: image-caption-generator-web-app
28+
spec:
29+
ports:
30+
- port: 8088
31+
selector:
32+
app: image-caption-generator-web-app
33+
type: LoadBalancer

0 commit comments

Comments
 (0)