Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated image versions, updated config, aligning with resources in bo… #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Chapter02/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Chapter 2. Understanding containers

### Deploying resources
- [../scripts/apply.sh](../scripts/apply.sh) - helper script to deploy resource yaml files and update prefix values. Resource files should be specified as arguments.

### Creating the pod manifest for the Kiada application
- [pod.kiada.yaml](pod.kiada.yaml) - YAML manifest file for the `kiada` pod

### Creating the Kiada container image

Building the **`kiada:1.0`** image:
Expand Down
2 changes: 1 addition & 1 deletion Chapter02/kiada-0.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16
FROM node:22-alpine
COPY app.js /app.js
COPY html/ /html
ENTRYPOINT ["node", "app.js"]
Expand Down
12 changes: 8 additions & 4 deletions Chapter02/kiada-0.1/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
-include Makefile.overrides
-include ../../env

IMAGE ?= kiada:0.1
FULL_IMAGE_TAG = "$(PREFIX)$(IMAGE)"

all: image push
all: push

image:
@echo "Building image $(FULL_IMAGE_TAG)"
docker build -t $(FULL_IMAGE_TAG) ./

push:
push: image
docker push $(FULL_IMAGE_TAG)

luksa-run:
PREFIX=luksa/ make build push && k delete po kiada --force --grace-period 0 ; k apply -f ../../Chapter05/kiada.pod.yaml && k wait --for=condition=Ready pod/kiada && k port-forward kiada 8080
kind-load: image
kind load docker-image $(FULL_IMAGE_TAG)

run: kind-load
kubectl delete po kiada --force ; ../../scripts/apply.sh ../pod.kiada.yaml && kubectl wait --timeout=30s --for=condition=Ready pod/kiada && kubectl port-forward kiada 8080
11 changes: 11 additions & 0 deletions Chapter02/pod.kiada.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Pod
metadata:
name: kiada
spec:
containers:
- name: kiada
image: luksa/kiada:0.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
18 changes: 0 additions & 18 deletions Chapter03/admin-user.yaml

This file was deleted.

5 changes: 4 additions & 1 deletion Chapter03/create-deployment.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env bash
DIR="$(cd $(dirname $0) ; pwd -P)"

source "${DIR}/../env"

set -x

kubectl create deployment kiada --image=luksa/kiada:0.1
kubectl create deployment kiada --image="${PREFIX}kiada:0.1"

3 changes: 2 additions & 1 deletion Chapter03/create-kind-cluster.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
DIR=$(cd $(dirname $0) ; pwd -P)

kind create cluster --config kind-multi-node.yaml
kind create cluster --config "${DIR}/kind-multi-node.yaml"

16 changes: 9 additions & 7 deletions Chapter05/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

## Chapter 5. Running applications in Pods

### Deploying resources
- [../scripts/apply.sh](../scripts/apply.sh) - helper script to deploy resource yaml files and update prefix values. Resource files should be specified as arguments.

### Creating the pod manifest for the Kiada application
- [kiada.yaml](kiada.yaml) - YAML manifest file for the `kiada` pod
- [pod.kiada.yaml](pod.kiada.yaml) - YAML manifest file for the `kiada` pod

### Modifying the application to read from standard input
Building the **`kiada:1.0-stdin`** image:
Expand All @@ -13,9 +15,9 @@ Building the **`kiada:1.0-stdin`** image:
- [app.js](kiada-stdin-image/app.js) - application code (JavaScript)

Deploying the pod:
- [kiada-stdin.yaml](kiada-stdin.yaml) - manifest for the `kiada-stdin` pod
- [kiada-stdin-once.yaml](kiada-stdin-once.yaml) - manifest for the `kiada-stdin-once` pod, which uses `stdinOnce: true`
- [kiada-stdin-tty.yaml](kiada-stdin-tty.yaml) - manifest for the `kiada-stdin-tty` pod, which uses `tty: true`
- [pod.kiada-stdin.yaml](pod.kiada-stdin.yaml) - manifest for the `kiada-stdin` pod
- [pod.kiada-stdin-once.yaml](pod.kiada-stdin-once.yaml) - manifest for the `kiada-stdin-once` pod, which uses `stdinOnce: true`
- [pod.kiada-stdin-tty.yaml](pod.kiada-stdin-tty.yaml) - manifest for the `kiada-stdin-tty` pod, which uses `tty: true`

### Adding the Envoy proxy container to the kiada pod
Building the **`kiada-ssl-proxy:0.1`** image:
Expand All @@ -26,7 +28,7 @@ Building the **`kiada-ssl-proxy:0.1`** image:
- [example-com.key](kiada-ssl-proxy-image/example-com.key) - Private key used by Envoy

Deploying the pod:
- [kiada-ssl.yaml](kiada-ssl.yaml) - Manifest for the `kiada-ssl` pod
- [pod.kiada-ssl.yaml](pod.kiada-ssl.yaml) - Manifest for the `kiada-ssl` pod


### Creating a pod with init containers
Expand All @@ -41,5 +43,5 @@ Building the **`network-connectivity-checker:0.1`** image:
- [docker_entrypoint.sh](network-connectivity-checker-0.1/docker_entrypoint.sh) - Shell script that runs in the container

Deploying the pod:
- [kiada-init.yaml](kiada-init.yaml) - Manifest for the `kiada-init` pod
- [kiada-init-slow.yaml](kiada-init-slow.yaml) - Manifest for the `kiada-init-slow` pod, whose init container takes 60s to start
- [pod.kiada-init.yaml](pod.kiada-init.yaml) - Manifest for the `kiada-init` pod
- [pod.kiada-init-slow.yaml](pod.kiada-init-slow.yaml) - Manifest for the `kiada-init-slow` pod, whose init container takes 60s to start
10 changes: 7 additions & 3 deletions Chapter05/init-demo-0.1/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
-include Makefile.overrides
-include ../../env

IMAGE ?= init-demo:0.1
FULL_IMAGE_TAG = "$(PREFIX)$(IMAGE)"

all: image push
all: push

image:
@echo "Building image $(FULL_IMAGE_TAG)"
docker build -t $(FULL_IMAGE_TAG) ./

push:
docker push $(FULL_IMAGE_TAG)
push: image
docker push $(FULL_IMAGE_TAG)

kind-load: image
kind load docker-image $(FULL_IMAGE_TAG)
2 changes: 1 addition & 1 deletion Chapter05/kiada-0.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16
FROM node:22-alpine
COPY app.js /app.js
COPY html/ /html
ENTRYPOINT ["node", "app.js"]
Expand Down
12 changes: 8 additions & 4 deletions Chapter05/kiada-0.2/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
-include Makefile.overrides
-include ../../env

IMAGE ?= kiada:0.2
FULL_IMAGE_TAG = "$(PREFIX)$(IMAGE)"

all: image push
all: push

image:
@echo "Building image $(FULL_IMAGE_TAG)"
docker build -t $(FULL_IMAGE_TAG) ./

push:
push: image
docker push $(FULL_IMAGE_TAG)

luksa-run:
PREFIX=luksa/ make build push && k delete po kiada --force --grace-period 0 ; k apply -f ../../Chapter05/kiada.pod.yaml && k wait --for=condition=Ready pod/kiada && k port-forward kiada 8080
kind-load: image
kind load docker-image $(FULL_IMAGE_TAG)

run: kind-load
kubectl delete po kiada --force ; ../../scripts/apply.sh ../pod.kiada.yaml && kubectl wait --timeout=30s --for=condition=Ready pod/kiada && kubectl port-forward kiada 8080
2 changes: 1 addition & 1 deletion Chapter05/kiada-ssl-proxy-0.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM envoyproxy/envoy:v1.14.1
FROM envoyproxy/envoy:v1.31-latest
COPY envoy.yaml /etc/envoy/envoy.yaml
COPY example-com.crt /etc/certs/example-com.crt
COPY example-com.key /etc/certs/example-com.key
Expand Down
10 changes: 7 additions & 3 deletions Chapter05/kiada-ssl-proxy-0.1/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
-include Makefile.overrides
-include ../../env

IMAGE ?= kiada-ssl-proxy:0.1
FULL_IMAGE_TAG = "$(PREFIX)$(IMAGE)"

all: image push
all: push

image:
@echo "Building image $(FULL_IMAGE_TAG)"
docker build -t $(FULL_IMAGE_TAG) ./

push:
docker push $(FULL_IMAGE_TAG)
push: image
docker push $(FULL_IMAGE_TAG)

kind-load: image
kind load docker-image $(FULL_IMAGE_TAG)
10 changes: 8 additions & 2 deletions Chapter05/kiada-ssl-proxy-0.1/envoy.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
admin:
access_log_path: /tmp/envoy.admin.log
access_log:
- name: envoy.access_log
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
path: /tmp/envoy.admin.log
address:
socket_address:
protocol: TCP
Expand All @@ -26,7 +30,7 @@ static_resources:
filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: ingress_http
route_config:
name: local_route
Expand All @@ -40,6 +44,8 @@ static_resources:
cluster: service_kiada_localhost
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
clusters:
- name: service_kiada_localhost
connect_timeout: 0.25s
Expand Down
10 changes: 7 additions & 3 deletions Chapter05/network-connectivity-checker-0.1/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
-include Makefile.overrides
-include ../../env

IMAGE ?= network-connectivity-checker:0.1
FULL_IMAGE_TAG = "$(PREFIX)$(IMAGE)"

all: image push
all: push

image:
@echo "Building image $(FULL_IMAGE_TAG)"
docker build -t $(FULL_IMAGE_TAG) ./

push:
docker push $(FULL_IMAGE_TAG)
push: image
docker push $(FULL_IMAGE_TAG)

kind-load: image
kind load docker-image $(FULL_IMAGE_TAG)
26 changes: 0 additions & 26 deletions Chapter05/pod.kiada-init.custom-ip.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion Chapter05/pod.kiada-stdin-once.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
containers:
- name: kiada
image: luksa/kiada:0.2
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
stdin: true
stdinOnce: true
ports:
Expand Down
2 changes: 1 addition & 1 deletion Chapter05/pod.kiada-stdin-tty.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
containers:
- name: kiada
image: luksa/kiada:0.2
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
stdin: true
tty: true
ports:
Expand Down
2 changes: 1 addition & 1 deletion Chapter05/pod.kiada-stdin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
containers:
- name: kiada
image: luksa/kiada:0.2
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
stdin: true
ports:
- containerPort: 8080
11 changes: 0 additions & 11 deletions Chapter05/pod.kiada.yaml

This file was deleted.

1 change: 1 addition & 0 deletions Chapter05/pod.kiada.yaml
14 changes: 7 additions & 7 deletions Chapter06/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

## Chapter 6. Managing the lifecycle of the Pod's containers

### Deploying resources
- [../scripts/apply.sh](../scripts/apply.sh) - helper script to deploy resource yaml files and update prefix values. Resource files should be specified as arguments.

### Adding a liveness probe
- [kiada-liveness.yaml](kiada-liveness.yaml) - YAML manifest file for the `kiada-liveness` pod
- [kiada-liveness-tcp-socket.yaml](kiada-liveness-tcp-socket.yaml) - YAML manifest file for the `kiada-liveness-tcp-socket` pod
- [kiada-liveness-exec.yaml](kiada-liveness-exec.yaml) - YAML manifest file for the `kiada-liveness-exec` pod
- [pod.kiada-liveness.yaml](pod.kiada-liveness.yaml) - YAML manifest file for the `kiada-liveness` pod

### Adding a startup probe
- [kiada-startup-probe.yaml](kiada-startup-probe.yaml) - YAML manifest file for the `kiada-startup-probe` pod
- [pod.kiada-startup-probe.yaml](pod.kiada-startup-probe.yaml) - YAML manifest file for the `kiada-startup-probe` pod

### Adding lifecycle hooks
- [quote-poststart.pod.yaml](quote-poststart.pod.yaml) - YAML manifest file for the `quote-poststart` pod
- [quote-prestop.pod.yaml](quote-prestop.pod.yaml) - YAML manifest file for the `quote-prestop` pod
- [pod.quote-poststart.yaml](pod.quote-poststart.yaml) - YAML manifest file for the `quote-poststart` pod
- [pod.quote-prestop.yaml](pod.quote-prestop.yaml) - YAML manifest file for the `quote-prestop` pod

### Setting the termination grace period
- [kiada-ssl-shortgraceperiod.yaml](kiada-ssl-shortgraceperiod.yaml) - YAML manifest file for the `kiada-ssl-shortgraceperiod` pod
- [pod.kiada-ssl-shortgraceperiod.yaml](pod.kiada-ssl-shortgraceperiod.yaml) - YAML manifest file for the `kiada-ssl-shortgraceperiod` pod

### Handling the TERM signal in the Kiada application
Building the **`kiada:1.1`** image:
Expand Down
2 changes: 1 addition & 1 deletion Chapter06/kiada-0.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16
FROM node:22-alpine
COPY app.js /app.js
COPY html/ /html
ENTRYPOINT ["node", "app.js"]
Expand Down
12 changes: 8 additions & 4 deletions Chapter06/kiada-0.3/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
-include Makefile.overrides
-include ../../env

IMAGE ?= kiada:0.3
FULL_IMAGE_TAG = "$(PREFIX)$(IMAGE)"

all: image push
all: push

image:
@echo "Building image $(FULL_IMAGE_TAG)"
docker build -t $(FULL_IMAGE_TAG) ./

push:
push: image
docker push $(FULL_IMAGE_TAG)

luksa-run:
PREFIX=luksa/ make build push && k delete po kiada --force --grace-period 0 ; k apply -f ../../Chapter05/kiada.pod.yaml && k wait --for=condition=Ready pod/kiada && k port-forward kiada 8080
kind-load: image
kind load docker-image $(FULL_IMAGE_TAG)

run: kind-load
kubectl delete po kiada --force ; ../../scripts/apply.sh ../pod.kiada.yaml && kubectl wait --timeout=30s --for=condition=Ready pod/kiada && kubectl port-forward kiada 8080
Loading