Chapter 11 & 12 updates
Signed-off-by: Lachlan Evenson <lachlan.evenson@gmail.com>
This commit is contained in:
parent
793b4f897d
commit
617d608be4
38
11-1-fluentd.yaml
Normal file
38
11-1-fluentd.yaml
Normal file
@ -0,0 +1,38 @@
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: fluentd
|
||||
labels:
|
||||
app: fluentd
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: fluentd
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: fluentd
|
||||
spec:
|
||||
containers:
|
||||
- name: fluentd
|
||||
image: fluent/fluentd:v0.14.10
|
||||
resources:
|
||||
limits:
|
||||
memory: 200Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 200Mi
|
||||
volumeMounts:
|
||||
- name: varlog
|
||||
mountPath: /var/log
|
||||
- name: varlibdockercontainers
|
||||
mountPath: /var/lib/docker/containers
|
||||
readOnly: true
|
||||
terminationGracePeriodSeconds: 30
|
||||
volumes:
|
||||
- name: varlog
|
||||
hostPath:
|
||||
path: /var/log
|
||||
- name: varlibdockercontainers
|
||||
hostPath:
|
||||
path: /var/lib/docker/containers
|
||||
@ -1,3 +0,0 @@
|
||||
# This is a sample config file that I might use to configure an application
|
||||
parameter1 = value1
|
||||
parameter2 = value2
|
||||
@ -1,31 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: kuard-config
|
||||
spec:
|
||||
containers:
|
||||
- name: test-container
|
||||
image: gcr.io/kuar-demo/kuard-amd64:1
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- "/kuard"
|
||||
- "$(EXTRA_PARAM)"
|
||||
env:
|
||||
- name: ANOTHER_PARAM
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: my-config
|
||||
key: another-param
|
||||
- name: EXTRA_PARAM
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: my-config
|
||||
key: extra-param
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /config
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: my-config
|
||||
restartPolicy: Never
|
||||
23
11-2-nginx-fast-storage.yaml
Normal file
23
11-2-nginx-fast-storage.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
apiVersion: apps/v1
|
||||
kind: 1DaemonSet
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
ssd: "true"
|
||||
name: nginx-fast-storage
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nginx
|
||||
ssd: "true"
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
ssd: "true"
|
||||
spec:
|
||||
nodeSelector:
|
||||
ssd: "true"
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:1.10.0
|
||||
@ -1,17 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: kuard-tls
|
||||
spec:
|
||||
containers:
|
||||
- name: kuard-tls
|
||||
image: gcr.io/kuar-demo/kuard-amd64:1
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: tls-certs
|
||||
mountPath: "/tls"
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: tls-certs
|
||||
secret:
|
||||
secretName: kuard-tls
|
||||
@ -1,19 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: kuard-tls
|
||||
spec:
|
||||
containers:
|
||||
- name: kuard-tls
|
||||
image: gcr.io/kuar-demo/kuard-amd64:1
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: tls-certs
|
||||
mountPath: "/tls"
|
||||
readOnly: true
|
||||
imagePullSecrets:
|
||||
- name: my-image-pull-secret
|
||||
volumes:
|
||||
- name: tls-certs
|
||||
secret:
|
||||
secretName: kuard-tls
|
||||
18
12-1-job-oneshot.yaml
Normal file
18
12-1-job-oneshot.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: oneshot
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: kuard
|
||||
image: gcr.io/kuar-demo/kuard-amd64:blue
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- "/kuard"
|
||||
args:
|
||||
- "--keygen-enable"
|
||||
- "--keygen-exit-on-complete"
|
||||
- "--keygen-num-to-gen=10"
|
||||
restartPolicy: OnFailure
|
||||
24
12-2-job-oneshot-failure1.yaml
Normal file
24
12-2-job-oneshot-failure1.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: oneshot
|
||||
labels:
|
||||
chapter: jobs
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
chapter: jobs
|
||||
spec:
|
||||
containers:
|
||||
- name: kuard
|
||||
image: gcr.io/kuar-demo/kuard-amd64:blue
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- "/kuard"
|
||||
args:
|
||||
- "--keygen-enable"
|
||||
- "--keygen-exit-on-complete"
|
||||
- "--keygen-exit-code=1"
|
||||
- "--keygen-num-to-gen=3"
|
||||
restartPolicy: OnFailure
|
||||
25
12-3-job-parallel.yaml
Normal file
25
12-3-job-parallel.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: parallel
|
||||
labels:
|
||||
chapter: jobs
|
||||
spec:
|
||||
parallelism: 5
|
||||
completions: 10
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
chapter: jobs
|
||||
spec:
|
||||
containers:
|
||||
- name: kuard
|
||||
image: gcr.io/kuar-demo/kuard-amd64:blue
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- "/kuard"
|
||||
args:
|
||||
- "--keygen-enable"
|
||||
- "--keygen-exit-on-complete"
|
||||
- "--keygen-num-to-gen=10"
|
||||
restartPolicy: OnFailure
|
||||
26
12-4-rs-queue.yaml
Normal file
26
12-4-rs-queue.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
apiVersion: apps/v1
|
||||
kind: ReplicaSet
|
||||
metadata:
|
||||
labels:
|
||||
app: work-queue
|
||||
component: queue
|
||||
chapter: jobs
|
||||
name: queue
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: work-queue
|
||||
component: queue
|
||||
chapter: jobs
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: work-queue
|
||||
component: queue
|
||||
chapter: jobs
|
||||
spec:
|
||||
containers:
|
||||
- name: queue
|
||||
image: "gcr.io/kuar-demo/kuard-amd64:blue"
|
||||
imagePullPolicy: Always
|
||||
16
12-5-service-queue.yaml
Normal file
16
12-5-service-queue.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: work-queue
|
||||
component: queue
|
||||
chapter: jobs
|
||||
name: queue
|
||||
spec:
|
||||
ports:
|
||||
- port: 8080
|
||||
protocol: TCP
|
||||
targetPort: 8080
|
||||
selector:
|
||||
app: work-queue
|
||||
component: queue
|
||||
9
12-6-load-queue.sh
Executable file
9
12-6-load-queue.sh
Executable file
@ -0,0 +1,9 @@
|
||||
|
||||
# Create a work queue called 'keygen'
|
||||
curl -X PUT localhost:8080/memq/server/queues/keygen
|
||||
|
||||
# Create 100 work items and load up the queue.
|
||||
for i in work-item-{0..99}; do
|
||||
curl -X POST localhost:8080/memq/server/queues/keygen/enqueue \
|
||||
-d "$i"
|
||||
done
|
||||
29
12-7-job-consumers.yaml
Normal file
29
12-7-job-consumers.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
labels:
|
||||
app: message-queue
|
||||
component: consumer
|
||||
chapter: jobs
|
||||
name: consumers
|
||||
spec:
|
||||
parallelism: 5
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: message-queue
|
||||
component: consumer
|
||||
chapter: jobs
|
||||
spec:
|
||||
containers:
|
||||
- name: worker
|
||||
image: "gcr.io/kuar-demo/kuard-amd64:blue"
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- "/kuard"
|
||||
args:
|
||||
- "--keygen-enable"
|
||||
- "--keygen-exit-on-complete"
|
||||
- "--keygen-memq-server=http://queue:8080/memq/server"
|
||||
- "--keygen-memq-queue=keygen"
|
||||
restartPolicy: OnFailure
|
||||
Loading…
Reference in New Issue
Block a user