Skip to content

Commit c7fc805

Browse files
committed
chore: Minor tuning
1 parent 4d4dde3 commit c7fc805

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

advanced/Controller/README.adoc

+10-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ Now you have a nice little Controller which watches on `ConfigMap` and restart `
5252
To try it out, we are reusing the super simple web application which just exposes an environment variable as content.
5353
This link:../images/mini-http-server.dockerfile[image] uses `nc` to deliver the content and can be found on Docker Hub as https://cloud.docker.com/u/k8spatterns/repository/docker/k8spatterns/mini-http-server[k8spatterns/mini-http-server].
5454

55-
Before we deploy this app, we should tail on the log of our controller (e.g. `kubectl logs -f config-watcher-controller-....`) to see the events received by the controller as they come in.
55+
Before we deploy this app, we should tail on the log of our controller (e.g. `kubectl logs -f config-watcher-controller-....`) to see the events received by the controller as they come in, e.g. with
56+
57+
[source,bash]
58+
----
59+
controller_pod=$(kubectl get pod -o name | grep config-watcher-controller | sed -e "s/^pods\///")
60+
kubectl logs -f $controller_pod config-watcher
61+
----
5662

5763
Then create the web application itself:
5864

@@ -65,6 +71,9 @@ kubectl create -f web-app.yml
6571
If you look into this descriptor, you will find a `Deployment` using our dumb HTTP server which references the content environment variable via a `ConfigMap`.
6672
The `ConfigMap` itself is annotated with a pod selector `k8spatterns.io/podDeleteSelector: "app=webapp"` which directly select the webapp `Pod`.
6773

74+
This resource file also includes the definition of a Service and an Ingress object so that we can access the server from the outside.
75+
76+
6877
You can access our web app directly
6978

7079
[source,bash]

advanced/Operator/README.adoc

+11-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ As a first step, we have to install the CRD along with a role to allow to modify
2525
----
2626
# Register ConfigWatcher CRD
2727
kubectl create -f config-watcher-crd.yml
28+
29+
# Verify that the CRD is registered
30+
$ kubectl get crd
31+
NAME CREATED AT
32+
configwatchers.k8spatterns.io 2018-12-28T17:19:28Z
2833
----
2934

3035
The operator script itself is stored in a `ConfigMap`:
@@ -82,6 +87,11 @@ We have to first install a concreate custom resource of kind `ConfigWatcher` to
8287
----
8388
# Install a ConfigWatcher custom resource
8489
kubectl create -f config-watcher-sample.yml
90+
91+
# Check that the resource has been created
92+
kubectl get configwatchers
93+
NAME AGE
94+
webapp-config-watcher 1m
8595
----
8696

8797
After this connection between `ConfigMap` and `Pods` has been configured, change the content of `ConfigMap` and watch the operator log:
@@ -96,6 +106,6 @@ and then finally call the URL again to check that the content has been updated
96106

97107
[source, bash]
98108
----
99-
# Access webapp via the included Ingress obect
109+
# Access webapp via the included Ingress object
100110
curl -sk https://webapp.$(minikube ip).nip.io
101111
----

0 commit comments

Comments
 (0)