You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
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
# Lab 3: Deploy an application with IBM Cloud Services
1
+
# Lab 3: Deploy an application with IBM Watson services
2
2
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.
4
4
5
-
We will be using the watson folder under the Lab 3 directory for the duration of the application.
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:
39
30
40
31
```yml
41
32
spec:
@@ -52,32 +43,25 @@ In `watson-deployment.yml`, update the image tag with the registry path to the i
52
43
```
53
44
54
45
55
-
# Create an IBM Cloud service via the cli
46
+
# Creating an instance of the IBM Watson service via the CLI
56
47
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.
58
49
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.
60
51
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.
62
53
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.
65
55
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.
68
57
69
-
name service plan bound apps last operation
70
-
tone tone_analyzer standard create succeeded
58
+
# Binding the Watson service to your cluster
71
59
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.
73
61
74
-
# Bind a Service to a Cluster
62
+
2. Verify the secret was created by running `kubectl get secrets`.
75
63
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
81
65
82
66
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:
83
67
@@ -92,39 +76,31 @@ Now that the service is bound to the cluster, we want to expose the secret to ou
92
76
secretName: 2a5baa4b-a52d-4911-9019-69ac01afbb7f-key0 # from the kubectl get secrets command above
93
77
```
94
78
95
-
Once the YAML configuration is updated, build the application using the yaml:
79
+
1. Build the application using the yaml:
96
80
- `cd "Lab 3"`
97
81
- `kubectl create -f watson-deployment.yml`
98
82
99
-
Verify the pod has been created:
83
+
2. Verify the pod has been created:
100
84
101
85
`kubectl get pods`
102
86
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.
114
88
115
89
# Putting It All Together - Run the Application and Service
116
90
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:
118
94
```
119
95
kubectl get pods
120
96
kubectl get deployments
121
97
kubectl get services
122
98
```
123
99
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:
125
101
126
102
`bx cs workers <name-of-cluster>`
127
103
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"`
129
105
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