Skip to content

Commit bf434d9

Browse files
committed
OKD lab
1 parent e81220e commit bf434d9

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ For questions/comments about Open Liberty Docker container or Open Liberty Opera
1313

1414
You'll need a few different artifacts to this lab. Check if you have these installed by running:
1515

16-
```bash
16+
```console
1717
git --help
1818
mvn --help
1919
java -help
@@ -63,11 +63,11 @@ You can clone the lab artifacts and explore the application:
6363

6464
1. Clone the project into your machine.
6565
```console
66-
git clone https://github.com/microservices-api/kubernetes-microprofile-lab.git
66+
$ git clone https://github.com/microservices-api/kubernetes-microprofile-lab.git
6767
```
6868
1. Navigate into the sample application directory:
6969
```console
70-
cd kubernetes-microprofile-lab/lab-artifacts/application
70+
$ cd kubernetes-microprofile-lab/lab-artifacts/application
7171
```
7272
1. See if you can find where technologies described below are used in the application.
7373

@@ -104,27 +104,27 @@ In this lab we demonstrate a best-practice pattern which separates the concerns
104104
The following steps will build the sample application and create a Docker image that includes the vote microservice:
105105

106106
1. Navigate into the sample application directory if you are not already:
107-
```bash
107+
```console
108108
$ cd kubernetes-microprofile-lab/lab-artifacts/application
109109
```
110110
1. Build the sample application:
111-
```bash
111+
```console
112112
$ mvn clean package
113113
```
114114
1. Navigate into the `lab-artifacts` directory
115-
```bash
115+
```console
116116
$ cd ..
117117
```
118118
1. Build and tag the Enterprise Docker image:
119-
```bash
119+
```console
120120
$ docker build -t microservice-enterprise-web:1.0.0 -f EnterpriseDockerfile .
121121
```
122122
1. Build and tag the Application Docker image:
123-
```bash
123+
```console
124124
$ docker build -t microservice-vote:1.0.0 -f ApplicationDockerfile .
125125
```
126126
1. You can use the Docker CLI to verify that your image is built.
127-
```bash
127+
```console
128128
$ docker images
129129
```
130130

@@ -133,23 +133,23 @@ The following steps will build the sample application and create a Docker image
133133
OKD provides an internal, integrated container image registry. For this lab, we will use this registry to host our application image.
134134

135135
1. Ensure you are logged in to OKD. You can use OKD command line interface (CLI) to interact with the cluster. Replace `<username>`, `<password>` and `<okd_ip>` with appropriate values:
136-
```bash
136+
```console
137137
$ oc login --username=<username> --password=<password>
138138
```
139139
1. Create a new project to host our application:
140-
```bash
140+
```console
141141
$ oc new-project myproject
142142
```
143143
1. Log into the internal registry:
144-
```bash
144+
```console
145145
$ oc registry login --skip-check
146146
```
147147
1. Tag your Docker image:
148-
```bash
148+
```console
149149
$ docker tag microservice-vote:1.0.0 docker-registry-default.apps.<okd_ip>.nip.io/myproject/microservice-vote:1.0.0
150150
```
151151
1. Now your tagged image into the registry:
152-
```bash
152+
```console
153153
$ docker push docker-registry-default.apps.<okd_ip>.nip.io/myproject/microservice-vote:1.0.0
154154
```
155155
1. Your image is now available in the internal registry in OKD. You can verify this through the OKD's Registry Dashboard available at `https://registry-console-default.apps.<okd_ip>.nip.io/registry`. You can use the same username and password as the one used in `oc login` command. You Should see
@@ -163,57 +163,57 @@ In this part of the lab you will install an operator and a Helm chart.
163163
In this section, we will deploy CouchDB Helm chart. However, as OKD does not come with tiller, we will install tiller on the cluster and set up Helm CLI to be able to communicate with the tiller.
164164

165165
1. Create a project for Tiller
166-
```bash
166+
```console
167167
$ oc new-project tiller
168168
```
169169
1. Download Helm CLI and install the Helm client locally:
170170

171171
Linux:
172-
```bash
172+
```console
173173
$ curl -s https://storage.googleapis.com/kubernetes-helm/helm-v2.9.0-linux-amd64.tar.gz | tar xz
174174
$ cd linux-amd64
175175
```
176176

177177
OSX:
178-
```bash
178+
```console
179179
$ curl -s https://storage.googleapis.com/kubernetes-helm/helm-v2.9.0-darwin-amd64.tar.gz | tar xz
180180
$ cd darwin-amd64
181181
```
182182

183183
1. Now configure the Helm client locally:
184-
```bash
184+
```console
185185
$ sudo mv helm /usr/local/bin
186186
$ sudo chmod a+x /usr/local/bin/helm
187187
$ helm init --client-only
188188
```
189189
1. Install the Tiller server:
190-
```bash
190+
```console
191191
$ oc process -f https://github.com/openshift/origin/raw/master/examples/helm/tiller-template.yaml -p TILLER_NAMESPACE="tiller" -p HELM_VERSION=v2.9.0 | oc create -f -
192192
$ oc rollout status deployment tiller
193193
```
194194
Rollout process might take a few minutes to complete.
195195
1. If things go well, the following commands should run successfully:
196-
```bash
196+
```console
197197
$ helm version
198198
```
199199
1. Grant the Tiller server `edit` and `admin` access to the current project:
200-
```bash
200+
```console
201201
$ oc policy add-role-to-user edit "system:serviceaccount:tiller:tiller"
202202
$ oc policy add-role-to-user admin "system:serviceaccount:tiller:tiller"
203203
```
204204

205205
Now that Helm is configured both locally and on OKD, you can deploy CouchDB Helm chart.
206206
1. Navigate to `lab-artifacts/helm/database`:
207-
```bash
207+
```console
208208
$ cd ../helm/database
209209
```
210210
1. Deploy the CouchDB Helm chart:
211-
```bash
211+
```console
212212
$ helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
213213
$ helm install incubator/couchdb -f db_values.yaml --name couchdb
214214
```
215215
Ensure the CouchDB pod is up and running by executing `kubectl get pods` command. Your output will look similar to the following:
216-
```bash
216+
```console
217217
NAME READY STATUS RESTARTS AGE
218218
couchdb-couchdb-0 2/2 Running 0 3m
219219
```
@@ -225,30 +225,30 @@ Now that Helm is configured both locally and on OKD, you can deploy CouchDB Helm
225225
#### Install Open Liberty artifacts
226226

227227
1. Navigate to Open Liberty Operator artifact directory:
228-
```bash
228+
```console
229229
$ cd lab-artifacts/operator/open-liberty-operator
230230
```
231231
1. Install Open Liberty Operator artifacts:
232-
```bash
232+
```console
233233
$ kubectl apply -f olm/open-liberty-crd.yaml
234234
$ kubectl apply -f deploy/service_account.yaml
235235
$ kubectl apply -f deploy/role.yaml
236236
$ kubectl apply -f deploy/role_binding.yaml
237237
$ kubectl apply -f deploy/operator.yaml
238238
```
239239
1. Creating a custom Security Context Constraints (SCC). SCC controls the actions that a pod can perform and what it has the ability to access.
240-
```bash
240+
```console
241241
$ kubectl apply -f deploy/ibm-open-liberty-scc.yaml --validate=false
242242
```
243243
1. Grant the default namespace's service account access to the newly created SCC, `ibm-open-liberty-scc`.
244-
```bash
244+
```console
245245
$ oc adm policy add-scc-to-group ibm-open-liberty-scc system:serviceaccounts:myproject
246246
```
247247

248248
#### Deploy application
249249

250250
1. Deploy the microservice application using the provided CR:
251-
```bash
251+
```console
252252
$ cd ../application
253253
$ kubectl apply -f application-cr.yaml
254254
```
@@ -277,11 +277,11 @@ The update scenario is that you will increase the number of replicas for the Lib
277277

278278
1. In `lab-artifacts/operator/application/application-cr.yaml` file, change `replicaCount` value to 3.
279279
1. Navigate to `lab-artifacts/operator/application` directory:
280-
```bash
280+
```console
281281
$ cd lab-artifacts/operator/application
282282
```
283283
1. Apply the changes into the cluster:
284-
```bash
284+
```console
285285
$ kubectl apply -f application-cr.yaml
286286
```
287287
1. You can view the status of your deployment by running `kubectl get deployments`. It might take a few minutes until all the pods are ready.

0 commit comments

Comments
 (0)