Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wuYin committed Apr 28, 2020
1 parent f9b3313 commit 78da10a
Show file tree
Hide file tree
Showing 15 changed files with 218 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ch05/kubia-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: kubia
spec:
rules:
- host: "kubia.example.com"
http:
paths:
- path: /kubia
backend:
serviceName: kubia-nodeport
servicePort: 80
- path: /user
backend:
serviceName: user-svc
servicePort: 90
- host: "google.com"
http:
paths:
- path: /
backend:
serviceName: gooele
servicePort: 8080
12 changes: 12 additions & 0 deletions ch07/config-files/my-nginx-config.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server {
listen 80;
server_name www.kubia-example.com;

gzip on;
gzip_types text/plain application/xml;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
1 change: 1 addition & 0 deletions ch07/config-files/sleep-interval
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
10 changes: 10 additions & 0 deletions ch07/fortune-args/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ubuntu:latest

RUN apt-get update ; apt-get -y install fortune
ADD fortuneloop.sh /bin/fortuneloop.sh

RUN chmod a+x /bin/fortuneloop.sh

ENTRYPOINT ["/bin/fortuneloop.sh"]

CMD ["10"]
13 changes: 13 additions & 0 deletions ch07/fortune-args/fortuneloop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
trap "exit" SIGINT

INTERVAL=$1
echo Configured to generate new fortune every $INTERVAL seconds

mkdir -p /var/htdocs

while :; do
echo $(date) Writing fortune to /var/htdocs/index.html
/usr/games/fortune >/var/htdocs/index.html
sleep $INTERVAL
done
1 change: 1 addition & 0 deletions ch07/fortune-auth/password.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IT'S EMPTY
10 changes: 10 additions & 0 deletions ch07/fortune-env/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ubuntu:latest

RUN apt-get update ; apt-get -y install fortune
ADD fortuneloop.sh /bin/fortuneloop.sh

RUN chmod a+x /bin/fortuneloop.sh

ENTRYPOINT ["/bin/fortuneloop.sh"]

CMD ["10"]
12 changes: 12 additions & 0 deletions ch07/fortune-env/fortuneloop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
trap "exit" SIGINT

echo Configured to generate new fortune every $INTERVAL seconds

mkdir -p /var/htdocs

while :; do
echo $(date) Writing fortune to /var/htdocs/index.html
/usr/games/fortune >/var/htdocs/index.html
sleep $INTERVAL
done
41 changes: 41 additions & 0 deletions ch07/fortune-pod-configmap-volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: v1
kind: Pod
metadata:
name: fortune-configmap-volume
spec:
containers:
- name: html-generator
image: yinzige/fortuneloop:env
env:
- name: INTERVAL
valueFrom:
configMapKeyRef:
key: sleep-interval
name: fortune-config # cm name
volumeMounts:
- mountPath: /var/htdocs
name: html
- name: web-server
image: nginx:alpine
volumeMounts:
- mountPath: /usr/share/nginx/html
name: html
readOnly: true
- mountPath: /etc/nginx/conf.d/gzip_in.conf
name: config
subPath: gzip.conf
readOnly: true
ports:
- containerPort: 80
name: http
protocol: TCP
volumes:
- name: html
emptyDir: {}
- name: config
configMap:
name: fortune-config # cm name
defaultMode: 0666
items:
- key: my-nginx-config.conf
path: gzip.conf #
18 changes: 18 additions & 0 deletions ch07/fortune-pod-env-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Pod
metadata:
name: fortune-env-from-configmap
spec:
containers:
- name: fortune-env
image: yinzige/fortuneloop:env
env:
- name: INTERVAL2
valueFrom:
configMapKeyRef:
name: fortune-config-cm
key: INTERVAL
envFrom:
- prefix: CONF_
configMapRef:
name: fortune-config-cm
16 changes: 16 additions & 0 deletions ch07/fortune-secret-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Pod
metadata:
name: fortune-with-serect
spec:
containers:
- name: fortune-auth-main
image: yinzige/fortuneloop
volumeMounts:
- mountPath: /tmp/no_password.txt
subPath: password.txt
name: auth
volumes:
- name: auth
secret:
secretName: fortune-auth
21 changes: 21 additions & 0 deletions ch07/fortuneloop-args-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Pod
metadata:
name: fortune5s
spec:
containers:
- name: html-generator
image: yinzige/fortuneloop:args
args:
- "5"
volumeMounts:
- mountPath: /var/htdocs
name: html
- name: web-server
image: nginx:alpine
volumeMounts:
- mountPath: /usr/share/nginx/html
name: html
volumes:
- name: html
emptyDir: {}
24 changes: 24 additions & 0 deletions ch07/fortuneloop-env-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
kind: Pod
metadata:
name: fortune6s
spec:
containers:
- name: html-generator
image: yinzige/fortuneloop:env
env:
- name: "INTERVAL"
value: "6"
- name: "NESTED_VAR"
value: "$(INTERVAL)_1"
volumeMounts:
- mountPath: /var/htdocs
name: html
- name: web-server
image: nginx:alpine
volumeMounts:
- mountPath: /usr/share/nginx/html
name: html
volumes:
- name: html
emptyDir: {}
1 change: 1 addition & 0 deletions ch07/interval_val.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
interval=9
14 changes: 14 additions & 0 deletions ch07/pod-with-private-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Pod
metadata:
name: private-it
spec:
imagePullSecrets:
- name: dockerhub-secret
containers:
- name: main
image: yinzige/busybox:secret
command:
- ls
args:
- /

0 comments on commit 78da10a

Please sign in to comment.