forked from wuYin/k8s-in-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
IT'S EMPTY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
interval=9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
- / |