Skip to content

Commit

Permalink
add walkthrough with k14s/k8s-simple-app
Browse files Browse the repository at this point in the history
  • Loading branch information
cppforlife committed Dec 2, 2019
1 parent bacfda7 commit 138f948
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
- [Install](install.md)
- [Config](config.md)
- [App CRD spec](app-spec.md)
- [Walkthrough](walkthrough.md)
187 changes: 187 additions & 0 deletions docs/walkthrough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
## Walkthrough

Goal of this walkthrough is to demonstrate how to install a simple HTTP server on Kubernetes with kapp-controller. We will use `examples/simple-app-git` directory as our YAML configuration.

- Start by [installing](install.md) kapp-controller onto cluster

- Install [k8s-simple-app-example](https://github.com/k14s/k8s-simple-app-example) App CR

```bash
$ kapp deploy -a simple-app -f examples/simple-app-git/1.yml

Changes

Namespace Name Kind Conds. Age Op Wait to Rs Ri
default simple-app App - - create reconcile - -

Op: 1 create, 0 delete, 0 update, 0 noop
Wait to: 1 reconcile, 0 delete, 0 noop

Continue? [yN]: y

5:20:27PM: ---- applying 1 changes [0/1 done] ----
5:20:27PM: create app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
5:20:27PM: ---- waiting on 1 changes [0/1 done] ----
5:20:27PM: ongoing: reconcile app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
5:20:33PM: ok: reconcile app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
5:20:33PM: ---- applying complete [1/1 done] ----
5:20:33PM: ---- waiting complete [1/1 done] ----

Succeeded
```

- Check out status of our App CR

```bash
$ kapp i -a simple-app --status

Resources in app 'simple-app'

Namespace default
Name simple-app
Kind App
Status conditions:
- status: "True"
type: ReconcileSucceeded
deploy:
exitCode: 0
finished: true
startedAt: "2019-12-02T22:20:28Z"
stdout: |-
Changes
Namespace Name Kind Conds. Age Op Wait to Rs Ri
default simple-app Deployment - - create reconcile - -
^ simple-app Service - - create reconcile - -
Op: 2 create, 0 delete, 0 update, 0 noop
Wait to: 2 reconcile, 0 delete, 0 noop
10:20:28PM: ---- applying 2 changes [0/2 done] ----
10:20:28PM: create service/simple-app (v1) namespace: default
10:20:28PM: create deployment/simple-app (apps/v1) namespace: default
10:20:29PM: ---- waiting on 2 changes [0/2 done] ----
10:20:29PM: ok: reconcile service/simple-app (v1) namespace: default
10:20:29PM: ongoing: reconcile deployment/simple-app (apps/v1) namespace: default
10:20:29PM: ^ Waiting for 1 unavailable replicas
10:20:29PM: L ok: waiting on replicaset/simple-app-6fb57f844b (apps/v1) namespace: default
10:20:29PM: L ongoing: waiting on pod/simple-app-6fb57f844b-jk7d8 (v1) namespace: default
10:20:29PM: ^ Pending: ContainerCreating
10:20:29PM: ---- waiting on 1 changes [1/2 done] ----
10:20:31PM: ok: reconcile deployment/simple-app (apps/v1) namespace: default
10:20:31PM: ---- applying complete [2/2 done] ----
10:20:31PM: ---- waiting complete [2/2 done] ----
Succeeded
updatedAt: "2019-12-02T22:20:31Z"
fetch:
exitCode: 0
startedAt: "2019-12-02T22:20:27Z"
updatedAt: "2019-12-02T22:20:27Z"
inspect:
exitCode: 0
stdout: |-
Resources in app 'simple-app-ctrl'
Namespace Name Kind Owner Conds. Rs Ri Age
default simple-app Deployment kapp 2/2 t ok - 4s
default L simple-app-6fb57f844b ReplicaSet cluster - ok - 4s
default L.. simple-app-6fb57f844b-jk7d8 Pod cluster 4/4 t ok - 4s
default simple-app Service kapp - ok - 4s
default L simple-app Endpoints cluster - ok - 4s
Rs: Reconcile state
Ri: Reconcile information
5 resources
Succeeded
updatedAt: "2019-12-02T22:20:32Z"
observedGeneration: 2
template:
exitCode: 0
updatedAt: "2019-12-02T22:20:28Z"

1 resources

Succeeded
```

- Update simple-app App CR to reconfigure simple-app

```bash
$ kapp deploy -a simple-app -f examples/simple-app-git/2.yml -c

--- update app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
...
23, 23 template:
24 - - ytt: {}
24 + - ytt:
25 + inline:
26 + pathsFrom:
27 + - secretRef:
28 + name: simple-app-values
25, 29 status:
26, 30 conditions:
--- create secret/simple-app-values (v1) namespace: default
0 + apiVersion: v1
1 + kind: Secret
2 + metadata:
3 + labels:
4 + kapp.k14s.io/app: "1575325198404867000"
5 + kapp.k14s.io/association: v1.7a671029ad7db07aa797301eac59e9ad
6 + name: simple-app-values
7 + namespace: default
8 + stringData:
9 + values2.yml: |
10 + #@data/values
11 + ---
12 + hello_msg: updated
13 +

Changes

Namespace Name Kind Conds. Age Op Wait to Rs Ri
default simple-app App 1/1 t 2m update reconcile ok -
^ simple-app-values Secret - - create reconcile - -

Op: 1 create, 0 delete, 1 update, 0 noop
Wait to: 2 reconcile, 0 delete, 0 noop

Continue? [yN]: y

5:23:13PM: ---- applying 2 changes [0/2 done] ----
5:23:13PM: update app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
5:23:13PM: create secret/simple-app-values (v1) namespace: default
5:23:14PM: ---- waiting on 2 changes [0/2 done] ----
5:23:14PM: ongoing: reconcile app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
5:23:14PM: ok: reconcile secret/simple-app-values (v1) namespace: default
5:23:14PM: ---- waiting on 1 changes [1/2 done] ----
5:23:17PM: ok: reconcile app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
5:23:17PM: ---- applying complete [2/2 done] ----
5:23:17PM: ---- waiting complete [2/2 done] ----

Succeeded
```

- Delete simple-app App CR

```bash
$ kapp delete -a simple-app

Changes

Namespace Name Kind Conds. Age Op Wait to Rs Ri
default simple-app App 1/1 t 6m delete delete ok -
^ simple-app-values Secret - 3m delete delete ok -

Op: 0 create, 2 delete, 0 update, 0 noop
Wait to: 0 reconcile, 2 delete, 0 noop

Continue? [yN]: y

5:26:25PM: ---- applying 2 changes [0/2 done] ----
5:26:25PM: delete secret/simple-app-values (v1) namespace: default
5:26:25PM: delete app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
5:26:26PM: ---- waiting on 2 changes [0/2 done] ----
5:26:26PM: ok: delete secret/simple-app-values (v1) namespace: default
5:26:26PM: ongoing: delete app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
5:26:26PM: ---- waiting on 1 changes [1/2 done] ----
5:26:30PM: ok: delete app/simple-app (kappctrl.k14s.io/v1alpha1) namespace: default
5:26:30PM: ---- applying complete [2/2 done] ----
5:26:30PM: ---- waiting complete [2/2 done] ----

Succeeded
```
File renamed without changes.
14 changes: 14 additions & 0 deletions examples/simple-app-git/1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: kappctrl.k14s.io/v1alpha1
kind: App
metadata:
name: simple-app
spec:
fetch:
- git:
url: https://github.com/k14s/k8s-simple-app-example
ref: origin/master
subPath: config-step-2-template
template:
- ytt: {}
deploy:
- kapp: {}
28 changes: 28 additions & 0 deletions examples/simple-app-git/2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: kappctrl.k14s.io/v1alpha1
kind: App
metadata:
name: simple-app
spec:
fetch:
- git:
url: https://github.com/k14s/k8s-simple-app-example
ref: origin/master
subPath: config-step-2-template
template:
- ytt:
inline:
pathsFrom:
- secretRef:
name: simple-app-values
deploy:
- kapp: {}
---
apiVersion: v1
kind: Secret
metadata:
name: simple-app-values
stringData:
values2.yml: |
#@data/values
---
hello_msg: updated

0 comments on commit 138f948

Please sign in to comment.