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

Commit f3fb773

Browse files
authored
Lab 3 testing complete
I completed testing lab 3 and made some big and small changes: - Deleted cat'ing of secrets because it didn't work and secrets weren't something users configured manually later - Added tip for registry quota probs - Tidied up some formatting and naming
1 parent 6ff776c commit f3fb773

File tree

1 file changed

+37
-61
lines changed

1 file changed

+37
-61
lines changed

Lab 3/README.md

Lines changed: 37 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,32 @@
1-
# Lab 3: Deploy an application with IBM Cloud Services
1+
# Lab 3: Deploy an application with IBM Watson services
22

3-
In this lab, we walk through setting up an application to leverage the Watson Tone Analyzer service. If you have yet to create a cluster, please refer to stage 1 of this walkthrough.
3+
In this lab, we walk through setting up an application to leverage the Watson Tone Analyzer service. If you have yet to create a cluster, please refer to lab 1 of this walkthrough.
44

5-
We will be using the watson folder under the Lab 3 directory for the duration of the application.
5+
# Deploying the Watson app
66

7-
# Lab steps
7+
1. Login to IBM Cloud Container Registry:
8+
`bx cr login`
89

9-
Run the following to begin this lab:
10+
2. Change the directory to `"Lab 3/watson"`.
1011

11-
1. Login to Container Registry
12-
- `bx cr login`
12+
3. Build the `watson` image:
13+
`docker build -t registry.ng.bluemix.net/<namespace>/watson .`
1314

15+
4. Push the `watson` image to IBM Cloud Container Registry:
16+
`docker push registry.ng.bluemix.net/<namespace>/watson`
1417

15-
2. Change current directory to `"Lab 3/watson"`
16-
- `cd "Lab 3/watson"`
18+
Tip: If you run out of registry space, clean up previous
19+
lab's images with this example command: `bx cr image-rm registry.ng.bluemix.net/<namespace>/hello-world:2`
1720

21+
5. Change the directory to `"Lab 3/watson-talk"`.
1822

19-
3. Build `watson` image
20-
- `docker build -t registry.ng.bluemix.net/<namespace>/watson .`
23+
6. Build the `watson-talk` image:
24+
`docker build -t registry.ng.bluemix.net/<namespace>/watson-talk .`
2125

22-
4. Push `watson` image to IBM Cloud Container Registry
23-
- `docker push registry.ng.bluemix.net/<namespace>/watson`
26+
7. Push the `watson-talk` image to IBM Cloud Container Registry:
27+
`docker push registry.ng.bluemix.net/<namespace>/watson-talk`
2428

25-
26-
5. Change current directory to `"Lab 3/watson-talk"`
27-
- `cd ../watson-talk`
28-
29-
30-
6. Build `watson-talk` image
31-
- `docker build -t registry.ng.bluemix.net/<namespace>/watson-talk .`
32-
33-
34-
7. Push `watson-talk` image to IBM Cloud Container Registry
35-
36-
- `docker push registry.ng.bluemix.net/<namespace>/watson-talk`
37-
38-
In `watson-deployment.yml`, update the image tag with the registry path to the image you created in the following two sections:
29+
8. In `watson-deployment.yml`, update the image tag with the registry path to the image you created in the following two sections:
3930

4031
```yml
4132
spec:
@@ -52,32 +43,25 @@ In `watson-deployment.yml`, update the image tag with the registry path to the i
5243
```
5344

5445

55-
# Create an IBM Cloud service via the cli
46+
# Creating an instance of the IBM Watson service via the CLI
5647

57-
In order to begin using the watson tone analyzer (the IBM Cloud service for this application), we must first request an instance of the analyzer in the org and space we have set up our cluster in. If you need to check what space and org you are currently using, simply run `bx login`. Then use `bx target --cf` to select the space and org you were using for stage 1 and 2 of the lab.
48+
In order to begin using the Watson Tone Analyzer (the IBM Cloud service for this application), we must first request an instance of the Watson service in the org and space we have set up our cluster in.
5849

59-
Once we have set our space and org, run `bx cf create-service tone_analyzer standard tone`, where `tone` is the name we will use for the watson tone analyzer service.
50+
1. If you need to check what space and org you are currently using, simply run `bx login`. Then use `bx target --cf` to select the space and org you were using for labs 1 and 2.
6051

61-
Run `bx cf services` to ensure a service named tone was created. You should see output like the following:
52+
2. Once we have set our space and org, run `bx cf create-service tone_analyzer standard tone`, where `tone` is the name we will use for the Watson Tone Analyzer service.
6253

63-
```
64-
Invoking 'cf services'...
54+
Note: When you add the Tone Analyzer service to your account, a message is displayed that the service is not free. If you [limit your API calls](https://www.ibm.com/watson/developercloud/tone-analyzer.html#pricing-block), this tutorial does not incur charges from the Watson service.
6555

66-
Getting services in org <org> / space <space> as <username>...
67-
OK
56+
3. Run `bx cf services` to ensure a service named `tone` was created.
6857

69-
name service plan bound apps last operation
70-
tone tone_analyzer standard create succeeded
58+
# Binding the Watson service to your cluster
7159

72-
```
60+
1. Run `bx cs cluster-service-bind <name-of-cluster> default tone` to bind the service to your cluster. This command will create a secret for the service.
7361

74-
# Bind a Service to a Cluster
62+
2. Verify the secret was created by running `kubectl get secrets`.
7563

76-
Run `bx cs cluster-service-bind <name-of-cluster> default tone` to bind the service to your cluster. This command will create a secret for the service.
77-
78-
Verify the secret was created by running `kubectl get secrets`
79-
80-
# Create pods and services
64+
# Creating pods and services
8165

8266
Now that the service is bound to the cluster, we want to expose the secret to our pod so it can utilize the service. You can do this by creating a secret datastore as a part of your deployment configuration. This has been done for you in watson-deployment.yml:
8367

@@ -92,39 +76,31 @@ Now that the service is bound to the cluster, we want to expose the secret to ou
9276
secretName: 2a5baa4b-a52d-4911-9019-69ac01afbb7f-key0 # from the kubectl get secrets command above
9377
```
9478
95-
Once the YAML configuration is updated, build the application using the yaml:
79+
1. Build the application using the yaml:
9680
- `cd "Lab 3"`
9781
- `kubectl create -f watson-deployment.yml`
9882

99-
Verify the pod has been created:
83+
2. Verify the pod has been created:
10084

10185
`kubectl get pods`
10286

103-
At this time, verify the secret was created and grab the json secret file to configure your application. Note that for this demo, this has been done for you:
104-
105-
`kubectl exec <pod_name> -it /bin/bash`
106-
107-
`cd /opt/service-bind`
108-
109-
`ls`
110-
111-
If the volume containing the secrets has been mounted, a file named `binding` should be in your CLI output. Cat the file and use it to configure your application to use the service.
112-
113-
`cat binding`
87+
At this time, your secret was created. Note that for this lab, this has been done for you.
11488

11589
# Putting It All Together - Run the Application and Service
11690

117-
By this time you have created pods, services and volumes for this lab. You can open the dashboard and explore all new objects created or use the following commands:
91+
By this time you have created pods, services and volumes for this lab.
92+
93+
1. You can open the Kubernetes dashboard and explore all new objects created or use the following commands:
11894
```
11995
kubectl get pods
12096
kubectl get deployments
12197
kubectl get services
12298
```
12399

124-
You have to find the Public IP for the worker node to access the application. Run the following command and take note of the same:
100+
2. Get the public IP for the worker node to access the application:
125101

126102
`bx cs workers <name-of-cluster>`
127103

128-
Now that the you got the container IP and port, go to your favorite web browswer and launch the following URL to analyze the text and see output: `http://<public-IP>:30080/analyze/<YourTextHere>`
104+
3. Now that the you got the container IP and port, go to your favorite web browser and launch the following URL to analyze the text and see output: `http://<public-IP>:30080/analyze/"Today is a beautiful day"`
129105

130-
If you can see JSON output on your screen, congratulations! You are done!
106+
If you can see JSON output on your screen, congratulations! You are done with lab 3!

0 commit comments

Comments
 (0)